Tuesday, May 22, 2007

JBoss, JAXB and JDK 1.6

While using JBoss 4.0.2, JAXB 2.1 and JDK 1.6 (a.k.a J2SE 6.0) if you get a linkage error similar to one discussed here then you should put jaxb-api.jar from JAXB RI into the endorsed directory used by Jboss. Putting it under jre/lib/endorsed directory has no affect as JBoss overrides the endorsed directory with its own. Place the jaxb-api.jar into $jboss-home/lib/endorsed directory instead. It should solve the linkage problem.

5 comments:

Anonymous said...

Thanks!
I had this problem while deploying an application and your tip solved it.
Best regards!

Anonymous said...

same with me :)

Thanks a lot!

Anonymous said...

The Solution

Anonymous said...

Let me add one more thing: If you start your JBoss from Eclipse using JBoss Tools, just putting the jaxb-api.jar into JBOSS_HOME/lib/endorsed won't help, because the JBoss Tools launch configuration ignores this directory unless you enter the VM argument -Djava.endorsed.dirs=YOUR/JBOSS/HOME/lib/endorsed in the properties of the JBoss server configuration. I spent a frustrating day finding out... :-(

Anonymous said...

Thanks! This also fixed a little different problem for me. However, it was a caused by a conflict in my servlet using Jaxb as does Jboss. I was getting:
java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl

I'm using Jaxb-api 2.1