When I first started working with Java to do real work, the servlet spec was pretty immature, and I was coming from a world of cgi-lib.pl and PHP. Things were quite simple. You wrote a class that had a method that received GET and POSTs, called some simple methods to get the decoded query string parameters, and printed out the results. It was easy to learn, but the code was not pretty or well organized. Calls to the database were simple, ugly, and prone to connection leaks. They were easy to write, however.
Fast forward to 10 years later, and in order to write a “clean” Java web app, you need to be using an MVC framework, persistence APIs, etc. This involves pulling in a complicated tree of JAR dependencies, composing complicated XML configuration, and implementing highly abstracted interfaces which require quite a bit of thinking to get your head around. I can’t help but think if I were just getting into Java right now, I’d be intimidated almost to the point of giving up.
Java is still pretty solidly established in the “enterprise” space, so I don’t see it disappearing anytime soon. If you want to look to the future, however, it is probably wise to take a look at what the smaller companies and startups are doing. They have the benefit of starting fresh and being able to use the technologies that most effectively support their goals, without having to port existing stuff/retrain staff. Java is present in those environments, but other technologies seem to be far more well represented. I wonder how much this has to do with the Java community’s progression over the last several years to the point where it is highly complicated and difficult to learn.