Controlling the Platform - Apple and Java


As a Java developer, I appreciate a very flexible development environment. I want to be able to mix and match tools that conform to a given standard - which is why we have standards! - in order to be most effective in my role of satisfying clients with as simple and non-vendor-locked-in solution as I can.

Now before you go off because I’m bashing the “beloved Darling” that is Apple, understand that I have a very legitimate beef with them when it comes to Java on OSX - which I will describe in excruciating language - not detail, just language.

For instance, I don’t like Microsoft’s approach to “Embrace, Extend and Extinguish” and for obvious reason - I’m a big supporter of free software - as in beer and speech. I use a great many of the tools that are published through the various open source channels.

Whether that be the Jakarta Commons libraries, Apache Tomcat (thank you Sun for the code donation) and most recently (for me) Apache Geronimo, I can rely on quality and community involvement and support and Geronimo is no different.

Geronimo is a world class certified Java Enterprise Edition (JEE) application server that includes such things as Tomcat (or Jetty) as its servlet container, openEJB as it’s EJB container, ActiveMQ for protocol-based messaging and either Apache Axis2 or CXF (Celtix + XFire = CXF) for webservices. The latter of which is todays pain point on OSX thanks to Apple’s “rendition” of Java 5.

To the point...

I was creating a simple webservice in order to get familiar with Geronimo webservices and their deployment engine and needed to generate the WSDL document and XSD. Geronimo 2.x uses JAX-WS webservices and includes wsgen for generating, in my case, the above needed WSDL artifacts - the WSDL document and the XML schema file.

My first attempt was running the following command:

jaxws/wsgen -classpath ${wsdl.dir}/source.jar -d ${wsdl.dir} 
 -wsdl:soap1.1 com.duummass.samples.jws.MyAwesomeService

To wit, wsgen thusly responds:

ERROR NotFoundException: jaxws/wsgen

Alright, fire up Firefox and let Google inform me as to the error in my ways...ahhhh, wait, a bug in Geronimo, got’s worked more time:

12:41:48,698 WARN  [JAXWSTools] Missing /System/Library/Frameworks/ \
 This may be required for wsgen to run.

What? It appears as though wsgen, part of the Webservice WS-* specification, assumes that all Java implementations have a lib directory under $JAVA_HOME. Well they do. Don’t they? Windows? Check! Linux? Which distro? Red Hat-based! Check! OSX? Nope! What the...? OSX has the following directory layout under $JAVA_HOME:


Huh? Here’s what the directories look like on Linux:


That’s odd. My error message is complaining about not being able to find a lib directory under the JDK root and it’s correct, one doesn’t exist, not on OSX on my Mac. Fair enough...hack...sudo mkdir...woosh...WEEZERD!!!...voila, I have one:

12:54:59,732 WARN  [JAXWSTools] Missing tools.jar in \
 This may be required for wsgen to run.

Tools.jar!!! Et tu, tools.jar? Hey, Google! Ahhhhhh...on OSX Apple has munged tools.jar into Classes/Classes.jar. Why? Who link...WEEZERD!!!! tools.jar now points to Classes.jar: no errors, just a WSDL document and an XML schema definition - satisfaction!

But why did I have to provide a symbolic link to fool wsgen into believing that tools.jar actually existed on my Mac under the lib directory? The fact remains that Apple modified the directory layout of a standard Java installation for whatever reason.

And don’t think for a minute that I’ll believe it was for “...proper functioning of OSX applications...”, that’s simply not true.

Hey, it’s their OS, they can do whatever the heck they want, but my first thought after this fiasco was to ponder, for a split second, should I be doing all of my development on Windows? AAAAAAAAARRRRRRRRRRGGGGGGGGGGGG!!!

Heck no! Apple, I forgive you...sort of.

The primary issue I have is that OSX is built on a BSD core. I know for a fact that a BSD Java installation looks very similar to the one I showed earlier on Linux. The only question I have is, why did Apple alter the layout?