Impure java

It’s surprising how many J2EE application servers go out of their way to be impure java. For the uninitiated, java has a perfectly functional launch model. You can specify all your classpath dependencies via a manifest file, and all your environment variables on the command line (of course, being a considerate developer, you make sure your app runs with sensible defaults if no env vars are specified). All you have to do is double click on a jar file (if you’re a windows weenie or enlightened OSXer), or run it with java -jar myapp.jar (if you’re a linux zealot, solaris diehard, enlightened OSXer, or anything else vaguely unixy).

Yet, despite this wonderful system (which does have its flaws, admittedly), most application servers go out of their way to make the process more complicated, less intuitive, more cumbersome, and generally as uncivilised as possible.

For example, Weblogic comes with a bevy of cmd and sh files. They all gleefully call one another, and have much hardcoding in them to explicitly disallow anything other than their official platforms to run. Amusingly enough, a few minutes of hacking away at these evil monstrosities and you’re able to get Weblogic running wonderfully on OSX, even if BEA recently proclaimed to me that they have no plans whatsoever to offer any sort of anything that is vaguely usable on OSX. The strange part is that the ONLY requirement is to make some of those idiotic cmd and sh files a bit more generic and usable, and suddenly, you have a developer preview edition of Weblogic on OSX.

Next up is JRun. This little appserver, written in pure java, has the most bizarre startup system of them all. I realise it’s quite functional and works nicely, but they try so hard to avoid using anything vaguely standard that it’s actually impossible to get their product to run on a platform they don’t officially support. They compile native binary launchers that presumably do very little beyond look for a JVM, specify a startup directory and JRun configuration. Still, at least after constant pestering they provide an OSX version.

As for Websphere, O Websphere…you evil monster. The pain, the horror, the sheer weight of a Websphere install is enough to make the baby Jesus cry hot tears of frustration. Yet again, a breathtaking array of launcher files (all platform specific). They win extra points for having most of their tools runtime.exec() their own launcher files, thus wisely ensuring that life is as difficult and unwieldy as possible for anyone wanting to fix that mess. Needless to say, Websphere is so tied to specific platforms that the server won’t even start up without invoking native code.

Tomcat also deserves an honourary mention, for pretending that it’s possible to have object oriented shell scripting, and splitting off functions into a number of scripts. Again, going out of its way to be un-userfriendly and unwieldy. Of course, this doesn’t matter much to tomcat users as Jakarta could feed them a fistful of steaming turds and they’d run off and write rave reviews about how innovative the flavour is.

As much as it pains me though, I have to give credit to JBoss. They seem to ‘get it’ as far as launching is concerned, and provide a nice jar file you can run. The only shame is that that is the high point of JBoss, and everything that happens after that initial launch is less impressive. Orion likewise manages to provide a simple and wonderfully effective launch mechanism.

I realise that in some cases, native code is needed. I also realise that in order to appease the marketing windows gods, you need to provide a .exe launcher. Please please don’t crap on the rest of us who don’t fill their underpants at the sight of a terminal though.

8 Responses to “Impure java”

  1. Jason Carreira Says:

    “As for Websphere, O Websphere…you evil monster. The pain, the horror, the sheer weight of a Websphere install is enough to make the baby Jesus cry hot tears of frustration.”

    This is just plain laugh out loud funny… thanks!

  2. Kevin Hooke Says:

    Hilarious, and oh so true!
    Anyone who has worked for any length of time with any of these servers will be laughing their asses off at this… because it’s all so true.
    If only the IBMs and BEAs would take notice… :-)

  3. Guillaume Desnoix Says:

    But the problem is not limited to server-side apps. Many desktop apps are so strangely and so stupidely launched. Some must be launched from a specific directories, some are looking to their classpath and the archive must have a special name, or try to find resources in separate places (not using getResource()). And so on. Even the JVM needs a writable home dir or complains (for Preferences). Please pack your app in a single jar and put it on the net. Or if it is bigger, use JNLP.
    Rgrds, Guillaume
    Java Desktop & Distro

  4. Doug Says:

    I work with WebSphere on a daily basis. Incredibly, an image of the baby Jesus has appeared on the wall of my cubicle and the tears are running down even as I speak.

    How did you know?

  5. Sam Pullara Says:

    Shell script for WebLogic. BEAHOME is where you installed it. BTW, I run on OSX as well, if you send me an email I might send you the ported native libraries back :)

    java -cp $BEAHOME:$BEAHOME/weblogic81/server/lib/weblogic.jar weblogic.Server

    All those shell scripts are for people who don’t know what a PATH is or how to find their dynamic libraries. Try that in an empty directory to create a new domain.

    Sam

  6. mele Says:

    Very true, but I liked to say that one app server I feel did a very good job in their design. Orion has a very easy to use configuration and start up and it’s also pure java.

    Should have been mentioned I think, but then again I’m an orion slut.

  7. Elder Styles Says:

    Java Runtime does not really provide a way to kill a process forked, (something like kill -9) especially if daemon threads are running. Thus WebSphere has to kill them using native code. Waiting for a hung server to exit is not good enough.

    my 2 cents.

  8. Jon Tirsen Says:

    You obviously haven’t had the pleasure (errr) of using Oracle Application Server. And I’m not talking about the sad mutilation that started it’s life as a nice little appserver somewhere in Sweden but ended up in the dirty hands of the insane Oracle hackers over there in evil Silicon Valley (I suppose it’s all been outsourced to India now though). OC4J (as it’s currently called even if it still has all the old package names from Sweden) is actually vaguely recognizable and therefor vaguely usable. I suppose they just haven’t had enough time to work on it.

    No, I’m actually talking about the real beast here. The full on Oracle Application Server. A completely schizofrenic mix of slashed open-source webservers, hacked CORBA ORBs, cut-wide open relational databases (oh, sorry, it’s post-relation now I suppose), insane text-files, LDAP servers… I don’t need to go on do I?

    This bizarre pile of shit has for some completely unknown reason ended up at several companies out there. Luckily not a single project I’ve seen has actually managed to deploy it yet. God knows what would happen if they actually managed to get it to start.

Leave a Reply