Incompatible neethi.jar with WAS 7

I am deploying one Apache CXF-2.7.5 application with neethi-3.0.2 in websphere 7. I am getting below the error. My spring application. When I downgraded Apache CXF to apache CXF-2.3.5. The application is successfully deployed.

The same thing works fine in Tomcat7.

I can reproduce this problem on Tomcat by adding (or overriding) the neethi.jar dependency (with an older version → 2.5.x) in the pom.xml file.

Note. Apache CXF 2.7.5 comes with the latest version of neethi.jar (3.0.2), so it doesn't cause a problem with Tomcat7.

Is the web scope an older version of neethi.jar

Stack trace below:

[7/9/13 19:46:38:577 GMT+05:30] 00000012 FfdcProvider I com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/ffdc/server1_2a7e2a7e_13.07.09_19.46.38.57558021.txt com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest() 309 [7/9/13 19:46:38:582 GMT+05:30] 00000012 webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[CXFServlet]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is 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: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1588) at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:350) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:292) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:99) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:167) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:722) 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: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl. 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) ... 35 more Caused by: org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl. at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:173) at org.apache.cxf.bus.extension.Extension.getClassObject(Extension.java:185) at org.apache.cxf.bus.extension.ExtensionManagerImpl.activateAllByType(ExtensionManagerImpl.java:138) at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:126) at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:138) at org.apache.cxf.bus.spring.SpringBus.<init>(SpringBus.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:45) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) at java.lang.reflect.Constructor.newInstance(Constructor.java:515) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ... 37 more Caused by: java.lang.IncompatibleClassChangeError: org.apache.neethi.AssertionBuilderFactory at java.lang.ClassLoader.defineClassImpl(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:265) at java.security.SecureClassLoader.defineClass(Unknown Source) at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:726) at com.ibm.ws.classloader.CompoundClassLoader.localFindClass(CompoundClassLoader.java:645) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:468) at java.lang.ClassLoader.loadClass(ClassLoader.java:609) 

Please, help

+4
source share
5 answers

I had to load the “parent_last” class at the web module level and delete the following jar files from the WAR: -

 geronimo-servlet_3.0_spec-1.0.jar geronimo-javamail_1.4_spec-1.7.1.jar stax-api-1.0.1.jar 

This is because of the AssertionBuilderFactory, which is an implementation of version 2.0.5 of neethi.jar, but is the interface in 3.0.2, which we use because of CXF 2.7.5.

Since these jar files are automatically added during build due to CXF dependencies, I think we will have to manually remove these banks from WAR before deploying to WAS. In addition, with each deployment, we will have to change the Class Loader setting for our WAR.

To reorder the Class loader, use the following path: Enterprise Applications> MyApplicationWAR> Manage Modules> MyApplicationWAR

EDIT:

You can do the same from your POM file using the <exclusions>

 <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-bundle-jaxrs</artifactId> <version>${cxf.version}</version> <exclusions> <exclusion> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-javamail_1.4_spec</artifactId> </exclusion> <exclusion> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-servlet_3.0_spec</artifactId> </exclusion> </exclusions> </dependency> <!-- Jettison Dependency --> <dependency> <groupId>org.codehaus.jettison</groupId> <artifactId>jettison</artifactId> <version>${jettison.version}</version> <exclusions> <exclusion> <groupId>stax</groupId> <artifactId>stax-api</artifactId> </exclusion> </exclusions> </dependency> 
+4
source

Yes, it is possible that WAS has an older version of neethi.

You should check the lib folder in websphere to see if there is an old version of neethi jar there. You may also need to configure your container to enable first-class self-loading if there is a version conflict of neethi.

Another option is to deploy the required neethi.jar in an approved directory, and then start the virtual machine with the appropriate parameters.

+1
source

I suggest you try setting the properties of the WAS class loader. Install the application class loader first, not the parent class loader. In this case, WAS will take the jar that you packed into the application. NTN

0
source

What effect does the removal of the following three cans have on solving the problem? I have a similar problem, but with a junit test and not using WAS. In my pump, I have neethi-3.0.1.jar and cxf-rt-core-2.7.4.jar. However, I still get java.lang.IncompatibleClassChangeError: org.apache.neethi.AssertionBuilderFactory at at org.apache.cxf.bus.extension.Extension so I assume that I still have an older version of neethi on the classpath. How to fix it? Jeronimo-servlet_3.0_spec-1.0.jar Jeronimo-javamail_1.4_spec-1.7.1.jar StAX-api-1.0.1.jar

0
source

Put the latest version of neethi.jar in the approved directory within you of Websphere Java for a quick fix, restart the JVM and try it.

-2
source

Source: https://habr.com/ru/post/1490688/


All Articles