smsclient.jar包冲突
Exception in thread "main" java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/Genuitec/Workspaces/oa/WebRoot/WEB-INF/lib/smsclient.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 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:210) at javax.xml.bind.ContextFinder.find(ContextFinder.java:368) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522) at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220) at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218) at java.security.AccessController.doPrivileged(Native Method) at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217) at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:88) 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 java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36) at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95) at javax.xml.ws.spi.Provider.provider(Provider.java:76) at javax.xml.ws.Service.<init>(Service.java:57) at mailservice.msgcenter.MailService.<init>(MailService.java:54) at mailclient.MailClient.getUntreated(MailClient.java:153) at com.egosystems.balasbrid.oa.TestReceiveMail.main(TestReceiveMail.java:13)
解决办法:
1、如果是application工程,则在程序中打印出
system.out.println(System.getProperty("java.endorsed.dirs"));
找到相应位置,将jaxb-api-2.1.jar和jaxb-impl-2.1.12.jar放到对应目录下即可。没有endorsed目录,自己建一个。
2、如果是java web项目,则在一个servlet之类的运行起来的项目中,打印:
system.out.println(System.getProperty("java.endorsed.dirs"));
找到相应位置,将jaxb-api-2.1.jar和jaxb-impl-2.1.12.jar放到对应目录下即可。没有endorsed目录,自己建一个。
我的WEB项目中,打印出来的路径是:E:\Java\apache-tomcat-7.0.19\endorsed
参考:http://blog.csdn.net/wangts/article/details/6116371
我有两个梦想,一是娶一美丽贤惠的姑娘,二是有一稳定踏实的工作。