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)

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.
ReplyDeleteAny 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... :-/
ReplyDeleteShould 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.
ReplyDeleteFixed mine with Peter's comment. Thanks peter and this post's author too.
ReplyDeletethank's Peter. It works for me.
ReplyDeleteI use Apache Tomcat 6.0.14 installed by NetBeans 6.0.1 .
Thanks for taking the time to post this. Fixed my problem!
ReplyDeleteYou are all very welcome. ;)
ReplyDeleteIt is really great help by peter on web
ReplyDeleteThank you.
ReplyDeleteMan, You saved my day. I was adding that directory to Java_home/lib and apparently it wasn't working..
ReplyDeletethis also problem with JDK1.7 and
ReplyDeletethank you very much ...
Check the following link to find out the fix for JBoss.
ReplyDeletehttp://kishantha.blogspot.com/2010/03/fixing-jaxb-linkageerror-in-jboss-with.html
How is the JAXB Linkage problem fixed inside an applet? After all, one can't go around copy jars into specific folder for anonymous users on the web.
ReplyDeleteIm using Tomcat 6 on Windows but I don't have the common/endorsed dir... where should I put it?
ReplyDeleteHelpful Post.
ReplyDelete