## Friday, May 11, 2007

### How To Fix LinkageError when using JAXB with JDK 1.6

If you run across an error like this when trying to use JAXB:

(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.

1. 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.

2. 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... :-/

3. 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.

4. Fixed mine with Peter's comment. Thanks peter and this post's author too.

5. thank's Peter. It works for me.
I use Apache Tomcat 6.0.14 installed by NetBeans 6.0.1 .

6. Thanks for taking the time to post this. Fixed my problem!

7. You are all very welcome. ;)

8. It is really great help by peter on web

9. Man, You saved my day. I was adding that directory to Java_home/lib and apparently it wasn't working..

10. this also problem with JDK1.7 and
thank you very much ...

11. Check the following link to find out the fix for JBoss.