CXF + SSL +网络逻辑9.10
我正在开发一个 Web 应用程序,它是一个 servlet,基本上充当 Web 服务的前端,我使用 CXF 作为 Web 服务客户端,该应用程序在 WebLogic 9.10 服务器上运行,一切正常,直到项目所有者决定添加 ssl support,没啥大问题,因为我使用 cxf without spring,我设法在服务客户端的 http 管道中配置 TLS 参数,还配置了一个包含服务器密钥、ca 根证书和客户端证书的密钥库,在开发tomcat实例下测试并运行良好。
当再次将应用程序重新部署到 weblogic 服务器并开始出现奇怪的错误时,问题就开始了,第一个错误是:
java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
at org.apache.cxf.frontend.ClientProxy.getClient
然后我意识到 weblogic 正在加载自己的 JAX-WS 实现,好吧,没有问题,只是添加了一个 weblogic.xml ,其中“更喜欢-” web-inf-classes”设置为 true,重新部署,现在我得到了这个异常:
java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the current class, com/adinfi/imgsvc/cm/service/CMBGenericWebServiceService, and the class loader (instance of <bootloader>) for resolved class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature
那个异常引起了我的注意,我认为类路径出了问题,所以我开始从应用程序中删除 jar,但仍然遇到更多链接错误,最后我得到的是这样的:
java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/w3c/dom/UserDataHandler"
这就是我的应用程序的“Web-Inf/lib/”目录现在的样子:
classes12.jar
classes12.zip
common.jar
common.resources.jar
commons-beanutils-1.8.0.jar
commons-discovery.jar
commons-logging-1.1.1.jar
commons-logging-api.jar
commons-logging-api-1.1.1.jar
cxf-2.2.5.jar
log4j-1.2.8.jar
ras.jar
runtimefw.jar
wsdl4j-1.6.2.jar
wss4j-1.5.8.jar
xalan-2.7.1.jar
xml-resolver-1.2.jar
XmlSchema-1.4.5.jar
xmlsec-1.4.3.jar
知道我做错了什么吗?提前致谢
I im developing a web application, its a servlet which basically acts as a front end for a web service, im using CXF for the web service client, the application is running on a WebLogic 9.10 server, every thing was working ok until the project owner decided to add ssl supprt, no big problem, since im using cxf whitout spring, i managed to configure the TLS parameters in the http conduit of the service client,also configured a keystore whit the server key, ca root certificate and a client certificate, tested under a development tomcat instance and worked fine.
Problems started when redeployed the app to the weblogic server again and started getting weird errors, first one was:
java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
at org.apache.cxf.frontend.ClientProxy.getClient
then i realized than weblogic was loading its own implementation of JAX-WS, ok no probelm, just added a weblogic.xml whit "prefer-web-inf-classes" set to true, redeployed and now i got this exception:
java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the current class, com/adinfi/imgsvc/cm/service/CMBGenericWebServiceService, and the class loader (instance of <bootloader>) for resolved class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature
That one got me, i thought something was wrong whit the class path,so i started removing jars from the application and still got some more linkage errors, last one i got is this:
java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/w3c/dom/UserDataHandler"
and this is how the "Web-Inf/lib/" directory of my application looks like now:
classes12.jar
classes12.zip
common.jar
common.resources.jar
commons-beanutils-1.8.0.jar
commons-discovery.jar
commons-logging-1.1.1.jar
commons-logging-api.jar
commons-logging-api-1.1.1.jar
cxf-2.2.5.jar
log4j-1.2.8.jar
ras.jar
runtimefw.jar
wsdl4j-1.6.2.jar
wss4j-1.5.8.jar
xalan-2.7.1.jar
xml-resolver-1.2.jar
XmlSchema-1.4.5.jar
xmlsec-1.4.3.jar
Any idea what im doing wrong? thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回滚
prefer-web-inf-classes
内容并遵循 CXF 文档的应用程序服务器特定配置指南。更准确地说,提供一个
weblogic-application.xml
,如第二个选项 将 war 打包到耳朵中,使用 weblogic-application.xml 部署耳朵,内容如下:按照 这篇文章 如果需要的话。
Rollback the
prefer-web-inf-classes
stuff and follow the WebLogic specific instructions from the Application Server Specific Configuration Guide of CXF's documentation.More precisely, provide a
weblogic-application.xml
as explained in the second option Pack war in an ear, deploy the ear with weblogic-application.xml with the following content:Follow the additional steps of this post if required.
我不太记得我是如何解决的。
我认为在我的 pom.xml 文件中删除 stax-api 的导入后问题就消失了。
更准确地说,就我而言,我必须将其从 poi-ooxml 中排除。
I am not sure to remember how I solved it.
I think the issue disappeared after removing the import of stax-api in my pom.xml file.
More precisely, in my case I had to exclude it from poi-ooxml.