`

CXF java.lang.IncompatibleClassChangeError异常

    博客分类:
  • SOA
阅读更多

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.


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics