January 13, 2009

Artifactory 2.0 on JBoss

Today I ran into some trouble getting Artifactory 2.0 (a great repository service for Maven) to work on JBoss AS 4.2 (and EAP 4.3, for that matter). After some investigation the root cause of the problem was Apache Derby which comes packaged with Artifactory. It starts a JMX Management Server which conflicts with JBoss and depending on what platform and version you try to run it on you get different exception messages, which was fairly confusing and difficult to explain.

One of the two exceptions that you may encounter, is:

ERROR[0] Exception sending context initialized event to listener instance of class org.artifactory.webapp.servlet.ArtifactoryContextConfigurer
java.lang.NoClassDefFoundError: Could not initialize class org.apache.derby.jdbc.EmbeddedDriver

And the other exception that was thrown (on Linux with JBoss AS 4.3.0.GA_CP03), was:

ERROR [org.apache.catalina.core.ContainerBase] Exception sending context initialized event to listener instance of class org.artifactory.webapp.servlet.ArtifactoryContextConfigurer
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

Anyway, there are several ways to get this to work.
  1. Add -Djboss.platform.mbeanserver to your JAVA_OPTS
  2. Patch artifactory-2.0.0.war/WEB-INF/lib/derby-10.4.2.0.jar/org/apache/derby/module.properties, commenting out the line derby.module.mgmt.jmx=\
    org.apache.derby.impl.services.jmx.JMXManagementService
  3. Download an unofficial (well, it's me that did it) pre-patched version here.
Good luck and enjoy the Artifactory 2.0!

[Update] The guys over at JFrog are aware of this problem and according to Yoav Landman the next version will come with a patched Derby. Naturally, at that point I will remove my pre-patched version since there is no sense in offering an outdated version :) Until then, go ahead and use mine or patch it yourself.

[Update 2] Artifactory 2.0.1 has been released and unfortunately, the patch hasn't been added to the module.properties. This basically means that you still have to patch the WAR-file yourself.

No comments: