CXF + SSL +网络逻辑9.10

发布于 2024-08-15 17:14:19 字数 1944 浏览 4 评论 0原文

我正在开发一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烈酒灼喉 2024-08-22 17:14:19

回滚 prefer-web-inf-classes 内容并遵循 CXF 文档的应用程序服务器特定配置指南
更准确地说,提供一个 weblogic-application.xml,如第二个选项 将 war 打包到耳朵中,使用 weblogic-application.xml 部署耳朵,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
    <application-param>
        <param-name>webapp.encoding.default</param-name>
        <param-value>UTF-8</param-value>
    </application-param>
    <prefer-application-packages>
        <package-name>javax.jws.*</package-name>
    </prefer-application-packages>
</weblogic-application>

按照 这篇文章 如果需要的话。

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:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
    <application-param>
        <param-name>webapp.encoding.default</param-name>
        <param-value>UTF-8</param-value>
    </application-param>
    <prefer-application-packages>
        <package-name>javax.jws.*</package-name>
    </prefer-application-packages>
</weblogic-application>

Follow the additional steps of this post if required.

久光 2024-08-22 17:14:19

我不太记得我是如何解决的。
我认为在我的 pom.xml 文件中删除 stax-api 的导入后问题就消失了。
更准确地说,就我而言,我必须将其从 poi-ooxml 中排除。

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9</version>
        <exclusions>
            <exclusion>
                <groupId>stax</groupId>
                <artifactId>stax-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

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.

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9</version>
        <exclusions>
            <exclusion>
                <groupId>stax</groupId>
                <artifactId>stax-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文