我正在使用neethi-3.0.2部署一个应用程序Apache CXF-2.7.5 websphere 7.我收到以下错误。我的应用是弹簧驱动的。 当我将Apache CXF降级为apache CXF-2.3.5时。申请成功 部署。
同样在Tomcat7中完美运作。
我可以通过在pom.xml文件中添加(或覆盖)neethi.jar(旧版本 - > 2.5.x)的依赖项来在Tomcat上重现此问题。
注意: Apache CXF 2.7.5附带最新版本的neethi.jar(3.0.2),因此不会导致Tomcat7出现问题。
Web领域是否会使用较旧版本的 neethi.jar
堆栈跟踪如下:
[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)
请帮忙
答案 0 :(得分:4)
我必须在web模块级别加载'parent_last'类并从WAR中删除以下jar文件: -
geronimo-servlet_3.0_spec-1.0.jar
geronimo-javamail_1.4_spec-1.7.1.jar
stax-api-1.0.1.jar
这是因为AssertionBuilderFactory是2.0版本的neethi.jar中的一个实现,但是由于CXF 2.7.5我们正在使用3.0.2中的接口。
由于CXF依赖性,这些jar文件会在构建时自动添加,我认为在WAS中部署之前,我们必须手动从WAR中删除这些jar文件。此外,对于每次部署,我们都必须更改WAR的Class Loader设置。
要更改类加载器顺序,请使用以下路径: - 企业应用程序&gt; MyApplicationWAR&gt;管理模块&gt; MyApplicationWAR
编辑:
您可以使用<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>
答案 1 :(得分:2)
是的,WAS可能有较旧版本的neethi。
您应该检查websphere的lib文件夹,看看那里是否有旧版本的neethi jar。如果存在neethi版本冲突,您可能还需要配置容器以启用自首先加载方法。
另一个选择是在endorsed目录中部署所需的neethi.jar,然后使用适当的参数启动VM。
答案 2 :(得分:0)
我建议你尝试设置WAS的类加载器属性。 首先将它设置为应用程序类加载器而不是父类加载器。有了这个,WAS将获取您在应用程序中打包的jar。 HTH
答案 3 :(得分:0)
删除以下三个罐子对问题的解决方案有什么影响?我有一个类似的问题,但有一个junit测试,而不是在WAS中运行。我的pom中有neethi-3.0.1.jar和cxf-rt-core-2.7.4.jar。但是我仍然得到java.lang.IncompatibleClassChangeError:org.apache.neethi.AssertionBuilderFactory at org.apache.cxf.bus.extension.Extension 所以我假设我在类路径上仍然有旧版本的neethi。 我如何解决它? Geronimo的servlet_3.0_spec-1.0.jar Geronimo的javamail_1.4_spec-1.7.1.jar STAX-API-1.0.1.jar
答案 4 :(得分:-2)
将最新版本的neethi.jar放在Websphere Java中的endorsed目录中,以获得快速解决方案,重新启动JVM并试用它。