If you run across an error like this when trying to use JAXB:
java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI
(from jar:file:/somedirectory/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
It's actually a very simple fix, but painful enough to warrant a post. Put the jaxb-api.jar that you're trying to use into JDK_HOME/jre/lib/endorsed. If the endorsed directory doesn't exist, make it. This is apparently only a problem with JDK 1.6, not with JDK 1.5.
Friday, May 11, 2007
How To Fix LinkageError when using JAXB with JDK 1.6
Subscribe to:
Post Comments (Atom)

7 comments:
Thanks for the post. The error is NOT resolved if one uses Tomcat (I use v. 5.5.1.7). I have tried putting the jaxb-api.jar file in the Tomcat ...\common\endorsed dir but to no avail.
Any comments?
I tried this fix for Tomcat 6.0.14 on Fedora 6 and it didn't work. After looking at the /bin scripts it seems that the default endorsed directory is: $CATALINA_HOME/endorsed. Copying jaxb-api-2.1.jar to this directory fixes the symptom you show above for my situation. I wish the Tomcat 6 doc was better... :-/
Should also point out that, under Windows, the correct spot for that jaxb-api-2.1.jar file is: %CATALINA_HOME%\common\endorsed. Same version--6.0.14--as the Tomcat version that I just commented on.
Fixed mine with Peter's comment. Thanks peter and this post's author too.
thank's Peter. It works for me.
I use Apache Tomcat 6.0.14 installed by NetBeans 6.0.1 .
Thanks for taking the time to post this. Fixed my problem!
You are all very welcome. ;)
Post a Comment