CXF与jdk冲突问题

在客户端与spring继承,测试时
cxf与java的包冲突

信息: Creating Service {http://service.css.ty.com/}MyFirstServiceHelloWorld from class com.ty.css.service.HelloWorldService
Exception in thread "main" java.lang.LinkageError: JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/E:/javaLib/cxf_all_jar/jaxb-impl-2.2.1.1.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.6.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)
等等

在jdk目录的lib下(如C:\Program Files\Java\jdk1.5.0_17\jre\lib)建立文件夹endorsed将cxf对应jaxb-api-xx.jar和jaxb-impl-xx.jar拷贝到目录里,并在项目中不要导入这两个jar

j2ee5包冲突
信息:java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
at javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:140)
at org.apache.cxf.attachment.AttachmentUtil.<clinit>(AttachmentUtil.java:61)
at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:61)

原因是项目中的java ee 5 libraries中的javaee.jar中activation/registries目录下没有LogSupport.jar所以要删除registries目录,方法用winrar打开eclipse目录下打开javaee.jar然后删除(如D:\Tools\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.5.0.me201003231033\data\libraryset\EE_5目录下的javaeye.jar),然后下载新版包含LogSupport.jar的activation.jar包添加到项目中即可

如果把javaee.jar删除的话会报java.lang.NoClassDefFoundError: javax/activation/DataHandler 所以要保证java ee 5 libraries目录下有javaee.jar并且里面包含activation/DataHandler.jar

备忘一下。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值