CXF java.lang.IncompatibleClassChangeError异常

CXF发布webservice在tomcat中没问题。

部署在Websphere中,直接访问WebServices没有问题,在访问?wsdl时出问题,问题出在wsdl4j-1.6.2.jar上面,也是ClassLoader的问题。

在网上搜到了 http://topic.csdn.net/u/20081025/17/3a60662f-a7aa-4454-a737-0a2863c7dda4.html

这里引用一下

建议用第二种

put jar in the endorsed folder
put the wsdl4j-1.6.1.jar in the $WebSphere_HOME/java/jre/lib/endorsed folder.
In the WebSphere console, find the specific enterprise application, click the "Class loading and update detection".
Mark the "Classes loaded with application class loader first" selected.
Mark the "Class loader for each war file in application" selected.
And then restart the Websphere server. (Because we changed the endorsed folder, we need to restart it to make it take effect).

Please make sure your classpath doesn't have the servlet-2.5 library, since WebSphere6.1 is servlet-2.4 compliant!


Add your own class loader
If you put your wsdl4j-1.6.1 jar in $WAS_HOME/java/jre/lib/endorsed, all your applications will depend on your version of wsdl4j. Another solution is to create a new class loader in your server which loads before parent class loader, create a shared library with your version of wsdl4j, and add this shared library to your new class loader. This version of wsdl4j will only be available for your specific server and not affect applications running in other servers.

Step by step

In the WAS console navigate to Environment > Shared Libraries
Select the scope you wish your library should be visible in
Click New and set values ex: name=MYAPP_SHARED_LIB, classpath=PATH_TO/wsdl4j-1.6.1.jar and Save
Navigate to Application servers > [your server name] > Java and Process Management > Class loader > New
Select Classes loaded with application class loader first and Save
Select your new class loader and click Shared library references
Add your shared library (MYAPP_SHARED_LIB) Save and restart your server.

Tested in WAS 6.1 only but should work in earlier versions as well.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值