websphere cxf factory 不兼容問題

来源:互联网 发布:如何修改tomcat的端口 编辑:程序博客网 时间:2024/05/23 14:22

If this is a record of possible occurences of this error then:

I just got this error on WAS (8.5.0.1), during the CXF (2.6.0) loading of the spring (3.1.1_release) configuration where a BeanInstantiationException rolled up a CXF ExtensionException, rolling up a IncompatibleClassChangeError. The following snippet shows the gist of the stack trace:

 

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException            at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162)            at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)            ... 116 moreCaused by: org.apache.cxf.bus.extension.ExtensionException            at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:167)            at org.apache.cxf.bus.extension.Extension.getClassObject(Extension.java:179)            at org.apache.cxf.bus.extension.ExtensionManagerImpl.activateAllByType(ExtensionManagerImpl.java:138)            at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:131)            [etc...]            at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)            ... 118 moreCaused by: java.lang.IncompatibleClassChangeError: org.apache.neethi.AssertionBuilderFactory            at java.lang.ClassLoader.defineClassImpl(Native Method)            at java.lang.ClassLoader.defineClass(ClassLoader.java:284)            [etc...]            at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:586)            at java.lang.ClassLoader.loadClass(ClassLoader.java:658)            at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:163)            ... 128 more


 

In this case, the solution was to change the classpath order of the module in my war file. That is, open up the war application in the WAS console under and select the client module(s). In the module configuration, set the class-loading to be "parent last".

This is found in the WAS console:

  • Applicatoins -> Application Types -> WebSphere Enterprise Applications
  • Click link representing your application (war)
  • Click "Manage Modules" under "Modules" section
  • Click link for the underlying module(s)
  • Change "Class loader order" to be "(parent last)".

 

原创粉丝点击