加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

CXF2.3.3兼容性问题

发布时间:2020-12-17 01:14:46 所属栏目:安全 来源:网络整理
导读:使用CXF2.3.3调用别人的webservice,启动tomcat后报错信息如下: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder at org.springfr

使用CXF2.3.3调用别人的webservice,启动tomcat后报错信息如下:

Invocation of init method failed; nested exception
 is java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.
v2.model.impl.RuntimeModelBuilder
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)

经查看使用JDK版本是为1.6.0rc版,该该版本默认自带的jaxb版本是:jaxb-api-2.1.jar及jaxb-api-2.1.jar,而CXF2.3.3自带的是jaxws-api-2.2.1.1.jar及jaxb-api-2.2.1.jar

解决方法如下:

1.升级jdk版本至1.6.20是可以解决该问题的。

2.让低版本jdk也能支持jaxws-api-2.2.1.1.jar及jaxb-api-2.2.1.jar,那么可以如下处理: 写一个main函数,输出System.out.println(System.getProperty(“java.endorsed.dirs”)); 获得endorsed目录的位置,如果没有endorsed目录则新建,删除老的版本,并将CXF自带的jaxws-api-2.2.1.1.jar及jaxb-api-2.2.1.jar放到endorsed目录下,那么jdk1.6.0rc调用的jaxws-api.jar及jaxb-api.jar也全是2.2以上的了

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读