JAXB 2.0 API is being loaded from the bootstrap classloader错误【转】

java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI(xxx) needs 2.1 API

在使用webservice,mule esb等需要jaxb的项目里经常会出现 JAXB 2.0 API is being loaded from the bootstrap classloader这个错误,按照打出的信息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/)去做,通常是解决不了问题的,该建议信息有两个问题导致不可行:

1. 不是下载jaxb-api.jar 而是下载jaxb-api-2.1.jar文件

2.不是把下载的这个jar文件放在sun网站给出的<java-home>/lib/endorsed 下,而是要自己试验确定应该放在哪个目录下:

确定放在哪个目录下的方法如下:

首先要看你的项目是java项目还是java web项目:

A, java项目直接打印System.out.println(System.getProperty("java.endorsed.dirs"));即是jaxb-api-2.1.jar应该放的目录。

B, java web 项目要用一个可以正常启动的web项目(当然没用到jaxbweb项目),打印System.out.println(System.getProperty("java.endorsed.dirs"));即可,我的是java web项目,打出的是E:/tomcat6/common/endorsed

 

我把jaxb-api-2.1.jar放到E:/tomcat6/common/endorsed下后问题解决。

注:没有common/endorsed目录的,自己创建。

 

 JAXB 2.0 API is being loaded from the bootstrap classloader

2010-05-11 16:55:13

JAXB 2.0 API is being loaded from the bootstrap classloader
 
SSH jdk6.0 Tomcat6.0环境中使用CXF 运行时报如下错误

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in URL [jar:file:/E:/workSpace/T82A/WebRoot/WEB-INF/lib/cxf/cxf-2.1.3.jar!/META-INF/cxf/cxf.fixml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/E:/workSpace/T82A/WebRoot/WEB-INF/lib/cxf/jaxb-impl-2.1.7.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/)

...
Caused by: java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/E:/workSpace/T82A/WebRoot/WEB-INF/lib/cxf/jaxb-impl-2.1.7.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/)
...

按照网上看说,在jdk1.6.0_05\jre\lib\下新建endorsed文件夹,放入jaxb-api.jar还是没有效果,经过我的仔细阅读E文,纠正这个错误,如果是Tomcat 5.5,则新建文件路径为“Tomcat 5.5\common\endorsed”,如果是Tomcat 6.0,则新建路径为“Tomcat 6.0\endorsed”。不是在jdk1.6.0_05\jre\lib\

 

你可能感兴趣的:(ClassLoader)