WebSphere 6.1 上的 CXF 类加载问题
我有一个具有以下配置的项目:
- WebSphere Application Server 6.1.0.19
- wsdl4j-1.6.2.jar 位于
$WAS_ROOT/java/jre/lib/ext
目录, (覆盖 WAS 6.1 中包含的 wsdl4j-1.6.1)。 - cxf-2.4.0.jar(以及其他依赖项)位于
$WAS_ROOT/lib/ext
目录中。 - 带有Web 模块“Y” 的EAR“X”。
- Web 模块“Y”有一个 JAR 模块“Z”(位于
WEB-INF/lib
目录)。 - “Z”有一组类,它们实现使用 CXF 的 wsdl2java 生成的 SOAP Web 服务。
- “Y”有一个业务类(位于
WEB-INF/classes
目录),它调用“Z”处的 SOAP Web 服务客户端。
此配置在我的开发环境(具有 WebSphere AS 6.1 运行时的 Rational Application Developer)中运行良好。但在 QA 环境中,我遇到了以下异常(请注意堆栈跟踪中的粗体):
org.apache.cxf.bus.extension.ExtensionException
在 org.apache.cxf.bus.extension.Extension.loadInterface(Extension.java:134)
在 org.apache.cxf.bus.extension.ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:160)
在 org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeansOfType(ExtensionManagerImpl.java:256)
在 org.apache.cxf.bus.CXFBusImpl.getExtension(CXFBusImpl.java:99)
在 org.apache.cxf.endpoint.ClientImpl.notifyLifecycleManager(ClientImpl.java:186)
在 org.apache.cxf.endpoint.ClientImpl.(ClientImpl.java:117)
在 org.apache.cxf.frontend.ClientFactoryBean.createClient(ClientFactoryBean.java:104)
在 org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:92)
在 org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152)
在 org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
在 org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)
在 org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)
在 org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)
在 javax.xml.ws.Service.getPort(Service.java:46)
位于 web.service.client.implementation.at.z.module.method(来源未知)
位于business.class.at.y.web.module.method(AvisoCobroDAO.java:86)
... 32 更多
引起:java.lang.ClassNotFoundException:org.apache.cxf.endpoint.ClientLifeCycleManager
位于 com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:472)
在 com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:373)
在 java.lang.ClassLoader.loadClass(ClassLoader.java:561)
在 org.apache.cxf.bus.extension.Extension.loadInterface(Extension.java:132)
... 51 更多 。
看起来像CompoundClassLoader(在应用程序级别工作)正在尝试加载存在于服务器运行时级别的CXF类
我希望有人能帮助我解决这个问题。我将非常非常感激。
I have a project with the following configuration:
- WebSphere Application Server 6.1.0.19
- wsdl4j-1.6.2.jar at the
$WAS_ROOT/java/jre/lib/ext
directory, (to overwrite wsdl4j-1.6.1 included in WAS 6.1). - cxf-2.4.0.jar (and others dependencies) at the
$WAS_ROOT/lib/ext
directory. - An EAR 'X' with a Web Module 'Y'.
- The Web Module 'Y' has a JAR Module 'Z' (at the
WEB-INF/lib
directory). - 'Z' has a set of classes that implement a SOAP Web Service generated using CXF's wsdl2java.
- 'Y' has a business class (at the
WEB-INF/classes
directory) that calls the SOAP Web Service Client at 'Z'.
This configuration works well at my development enviroment (Rational Application Developer with a WebSphere AS 6.1 runtime). But at the QA enviroment, I had the following exception, (please pay attention at bolds in the stack trace):
org.apache.cxf.bus.extension.ExtensionException
at org.apache.cxf.bus.extension.Extension.loadInterface(Extension.java:134)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:160)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeansOfType(ExtensionManagerImpl.java:256)
at org.apache.cxf.bus.CXFBusImpl.getExtension(CXFBusImpl.java:99)
at org.apache.cxf.endpoint.ClientImpl.notifyLifecycleManager(ClientImpl.java:186)
at org.apache.cxf.endpoint.ClientImpl.(ClientImpl.java:117)
at org.apache.cxf.frontend.ClientFactoryBean.createClient(ClientFactoryBean.java:104)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:92)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)
at javax.xml.ws.Service.getPort(Service.java:46)
at web.service.client.implementation.at.z.module.method(Unknown Source)
at business.class.at.y.web.module.method(AvisoCobroDAO.java:86)
... 32 more
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.endpoint.ClientLifeCycleManager
at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:472)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:373)
at java.lang.ClassLoader.loadClass(ClassLoader.java:561)
at org.apache.cxf.bus.extension.Extension.loadInterface(Extension.java:132)
... 51 more
Seems like the CompoundClassLoader
(which works at application level) is trying to load a CXF's class which exists at the server runtime level.
I hope somebody help me with this issue. I'll be very very grateful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 Jars 放在 WAS_HOME/lib/ext 中应该是最后的选择。
始终尝试 PARENT_LAST 类加载器模式并首先获取您的类/jar。
这将为您避免许多问题。
应用程序服务器启动将广泛使用此目录,如果存在冲突,它甚至可能无法启动。
排除故障的最佳方法是打开类加载并查看 native_stdout/stderr 文件,看看谁正在加载有问题的类。
Bkail,
你的意思是说不同的事情吗?该路径位于类加载器链的较高位置,因此会更早地检查它(使用默认的 PARENT_FIRST)类加载策略。
这将位于第二级(在 JDK 的 BOOT CLassloader 之后)及其扩展。
HTH
曼格鲁
Placing Jars in the WAS_HOME/lib/ext should be your last resort.
Always try the PARENT_LAST classloader mode and have your classes/jars picked up first.
This would avoid a number of problems for you.
The App Server start up would use this directory extensively and if there are clashes it might not even start up.
THe best way to troubleshoot is to turn on classloading and look at the native_stdout/stderr file and see who is loading the class(es) that is in question.
Bkail,
Did you mean to say things differently? This path is high up the class loader chain so it would be checked earlier (with the default PARENT_FIRST) class loading policy.
This would be in the second rung (after the BOOT CLassloader of the JDK) and it's extensions.
HTH
Manglu