CXF + SSL + WebLogic 9.10
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/QNa开发者_StackOverflowme 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
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.
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>
精彩评论