现在的位置: 首页 > 综合 > 正文

Error creating bean with name ‘org.apache.cxf.wsdl.WSDLManager’ defined in class path resource

2013年10月04日 ⁄ 综合 ⁄ 共 1384字 ⁄ 字号 评论关闭

 Context initialization failed
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource [META-INF/cxf/cxf.xml]:
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:/D:/DevProgram/Tomcat6/webapps/ctms/WEB-INF/lib/jaxb-impl-2.1.13.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/)

 

在spring项目增加cxf后,启动tomcat出现这样的错误

解决方法

按 ( 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项目(当然没用到jaxb的web项目),打印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目录的,自己创建。

 

重启tomcat,ok

抱歉!评论已关闭.