CXF 关于java.lang.LinkageError

项目集成CXF,起tomcat的时候报错

java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/D:/workspace/dayun/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/DmsProject/WEB-INF/lib/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/)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:173)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	 copy jaxb-api-2.1.jar和jaxws-api-2.1-1.jar两个文件到%TOMCAT_HOME%/common/endorsed文件夹

由异常我们可得知jaxb-api-2.1.jar包是有bootstrap加载的,别的classloader无法加载。

 

copy jaxb-api-2.1.jar和jaxws-api-2.1-1.jar两个文件到%TOMCAT_HOME%/common/endorsed文件夹

 

如果用main函数生成wsdl,需要把这个jaxb-api-2.1.jar放到Bootstrap中

 <!--StartFragment -->

 

 CXF 关于java.lang.LinkageError

你可能感兴趣的:(java,eclipse,tomcat,xml,sun)