问题总是不断的出现,解决了MTOM的问题,又有了新的问题:
Caused by: java.lang.LinkageError: JAXB 2.0 API is being loaded from the
bootstrap classloader, but this RI (from jar:file:/D:/software/java-related/apache-
cxf-2.2.10/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/)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>
(ModelBuilder.java:173)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet
(JAXBContextImpl.java:456)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>
(JAXBContextImpl.java:302)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build
(JAXBContextImpl.java:1140)
at com.sun.xml.bind.v2.ContextFactory.createContext
(ContextFactory.java:154)
at com.sun.xml.bind.v2.ContextFactory.createContext
(ContextFactory.java:121)
at com.sun.xml.bind.v2.ContextFactory.createContext
(ContextFactory.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at org.apache.cxf.wsdl.JAXBExtensionHelper.createJAXBContext
(JAXBExtensionHelper.java:196)
at org.apache.cxf.wsdl.JAXBExtensionHelper.getJAXBContext
(JAXBExtensionHelper.java:183)
at org.apache.cxf.wsdl.JAXBExtensionHelper.addExtensions
(JAXBExtensionHelper.java:168)
at org.apache.cxf.wsdl.JAXBExtensionHelper.addExtensions
(JAXBExtensionHelper.java:88)
at
org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions
(WSDLManagerImpl.java:263)
at
org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions
(WSDLManagerImpl.java:243)
at org.apache.cxf.wsdl11.WSDLManagerImpl.<init>
(WSDLManagerImpl.java:113)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass
(BeanUtils.java:100)
... 31 more
意思大概是需要jaxb 2.1,却加载了2.0,去lib目录下查看,自己明明加入的是jaxb-api-2.1.jar啊,去网上查到说是jdk本身有jaxb 2.0
解决办法是在jdk的lib或者jdk/jre目录(具体在哪个目录参考下面)下加入endorsed文件夹,把JAXB-API-2.1.jar和jaxws-api.jar放入endorsed文件夹中。
具体是要在哪个目录下,可以通过System.out.println(System.getProperty("java.endorsed.dirs")); 来查看你的endorsed目录的位置。
问题解决。
本文来自CSDN博客