title: Error: JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI needs 2.2 API
body: <p>I am trying to deploy a Java web service into a Tomcat 5.5.20 server.  I have the web service packaged in a .war file in Tomcat's webapps directory, and I can see that the .war file gets extracted when I start Tomcat.</p>
  
  <p>However, I get the following error when I start Tomcat:</p>
  
  <pre>Apr 22, 2012 5:16:31 AM com.sun.xml.ws.transport.http.servlet.WSServletContextLstener contextInitialized
  INFO: WSSERVLET12: JAX-WS context listener initializing
  Apr 22, 2012 5:16:31 AM com.sun.xml.ws.transport.http.servlet.WSServletContextLstener parseAdaptersAndCreateDelegate
  SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.LinkageError: JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/home/username/WebNMS/apache/tomcat/webapps/WebServices/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.6.0/docs/guide/standards/)
  java.lang.LinkageError: JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/home/username/WebNMS/apache/tomcat/webapps/WebServices/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.6.0/docs/guide/standards/)
  at com.sun.xml.bind.v2.model.impl.ModelBuilder.(ModelBuilder.java:178)
  </pre>
  
  <p>In the /home/username/WebNMS/apache/tomcat/webapps/WebServices/WEB-INF/lib directory is where all the jar files from JAX-WS 2.2.6 are, including jaxb-api.jar.</p>
  
  <p>I already added "-Djava.endorsed.dirs=/home/username/WebNMS/apache/tomcat/webapps/WebServices/WEB-INF/lib" to the command that starts the WebNMS process that starts Tomcat, but that didn't help.</p>
  
  <p>Also, I tried adding a symbolic link called "endorsed" in the /home/username/WebNMS/jre/lib directory that points to /home/username/WebNMS/apache/tomcat/webapps/WebServices/WEB-INF/lib, and that didn't help either.</p>
  
  <p>One interesting thing is that when I do a "find /home/username/WebNMS -name jaxb-api.jar", it only finds the one jaxb-api.jar in the /home/username/WebNMS/apache/tomcat/webapps/WebServices/WEB-INF/lib directory.  There are no other jaxb-api.jar files.  So I don't know why the error is saying that the JAXB 2.1 API is being loaded, when there's only the JAXB 2.2.6 API jar file.  Unless it's finding something outside the /home/username/WebNMS dir, but that shouldn't happen considering I tried 2 different ways to set up the endorsed dir.</p>