Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've just been through a lot of grief installing activemq on Debian Wheezy. apt-get install activemq installed a lot of packages - openjdk-jre + a raft of libraries, all of which ended up in /usr/share/java as far as I can make out. With a completely basic config, activemq started up fine, but as soon as I added any authentication or authorization sections to my config, it barfed with a NoClassDefFound error for org.objectweb.asm.commons.EmptyVisitor. This class is definitely provided by /usr/share/java/asm3-all.jar, which is happily installed on my system presumably as a result of the dependencies specified in the activemq package.

So what gives? After a fair bit more digging, it turns out that most of the jars required to operate activemq are also installed directly in /usr/share/activemq/lib - including asm3.jar, but, crucially, not asm3-all.jar, which includes the offending class. As an experiment, I copied the jar from /usr/share/java/ to the activemq lib directory... and it all worked fine.

So my question is: why on earth did the activemq package install 150+MB of jars in /usr/share/java if it actually doesn't use any of them??? In my days as a Java programmer I would have assumed that an java app would just have to bundle all of its dependencies and be done with it, but the fact that activemq pulls in all these libraries as dependent packages seems to suggest that someone thinks otherwise... or is this just a balls up?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

This is something that I think I'll start calling the "Linux Effect" on Java. When you use the package installer for Java and Java-based apps, the apps are installed according to general Linux standards: /etc for config, /usr for binaries, /bin for executables, etc. It scatters the bits around to such an extent that I've never made the leap to understanding how it's all organized. As a Java developer working with both RHEL and Ubuntu myself, I never use the package installer for any JDK or Java app--especially since then I'd have to remember where things are in two distros. As you said, most Java apps are a simple "download and extract to..." away to get them running. Then it's all in one place, and there's no question about where to look for things.

share|improve this answer
2  
We also don't use the system manager for our JVMs and the related libraries/tools. The other thing I ran into, which it looks like you have too is that the package maintainer has not fully tested features and has improperly set the class path, while it isn't hard to change it almost always meant having a custom catalina.sh or activemq-start.sh that meant we were already deviating from the systems packages. –  polynomial Oct 8 '11 at 19:44
    
As a java dev this was always my position as well. However I've got more of a sysadmin hat on at the moment and I'm working on bootstrapping a set of VMs in a fully-automated fashion (activemq is required for mcollective). Being able to install things and their dependencies through a package management system was thus an attractive prospect, and I had (foolishly) hoped that it might actually work. I figure that if I want to do this properly I'll just have to make my own local package that installs activemq and its config in a more sensible "java-ish" way. Sigh. –  hollandlef Oct 9 '11 at 13:38

The answer to how this is supposed to work is now a bit clearer to me after some digging. The activemq package depends on libactivemq-java, which is the package that installs everything in /usr/share/java. All the activemq package itself does is to set up a series of symlinks into /usr/share/java from its own lib directory. So the dependencies are used, it's just that in the case the package maintainer has failed to link in one of the jars that's actually necessary (I will report this as a bug). It would seem that the intention (for better or worse) is that java libraries get installed centrally through the package management system and linked to by the application as required using symlinks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.