possible solution for JBoss 5.1.0 GA classloader exceptions { java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl }

After having tinkered with standalone .WAR YT in JBoss 5.1.0 GA I may have found a solution for the ClassLoader exceptions that get thrown on several occasions.

The problem is that there are some libraries in the .WAR (/WEB-INF/lib/) that are colliding with older versions of the same libs in JBoss (at a higher path). JBoss tries to use its own libs that fail for certain operations.

There is a neat and controlled way to disable the container's libs and favor the .WAR's version in cases of a collision: by adding a file "jboss-classloading.xml" in the /WEB-INF/ directory.

I've added an example of this file, and here are some URLs to articles explaining how it works:

jboss-classloading.xml (159B)

Please sign in to leave a comment.