Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CXF 3.0.2 throwing " java.lang.AssertionError: UNIMPLEMENTED " exception in weblogic10.3

Tags:

cxf

weblogic

We are trying to make a webservice call using CXF framework involving CXF - ws security and the application being deployed in weblogic 10.3 , but receiving the below exception and seems like the weblogic specific jars are picked up , though the xercesimpl jar is present in the application in /WEB-INF/lib .

Options tried , but did not help:

  1. Setting the weblogic container descriptor with web-inf preferences

true .

  1. Setting the JVM arguments or system property as -

-Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl -Djavax.xml.soap.SOAPFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl -Djavax.xml.soap.SOAPConnectionFactory=weblogic.wsee.saaj.SOAPConnectionFactoryImpl

  1. Adding xercesimpl jar to maven pom.

    Exception

    ]] Root cause of ServletException. java.lang.AssertionError: UNIMPLEMENTED at weblogic.xml.domimpl.NodeImpl.setTextContent(NodeImpl.java:216) at org.apache.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeAttribute(XmlWriterToTree.java:137) at org.apache.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeNamespace(XmlWriterToTree.java:114) at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.marshal(DOMXMLSignature.java:211) at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(DOMXMLSignature.java:329) at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:578) at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:151) at org.apache.wss4j.dom.handler.WSHandler.doSenderAction(WSHandler.java:226) at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.access$100(WSS4JOutInterceptor.java:54) at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessageInternal(WSS4JOutInterceptor.java:282) at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:154) at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:141) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)enter code here at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:98) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)

    Thanks, Soumya

like image 949
Soumya Avatar asked Feb 24 '16 12:02

Soumya


1 Answers

I finally found the answer without modifying any weblogic startup script (tested on CXF 2.7.0 and weblogic 10.3.6

The reason for this issue is that CXF is not compatible with weblogic implementation of SAAJ. http://cxf.apache.org/docs/application-server-specific-configuration-guide.html

1. Q: I have this error: javax.xml.ws.WebServiceException: Cannot create SAAJ factory instance. A: Please make sure you have the saaj-impl-1.3.jar in the classpath and make sure your app picks up this one instead of weblogic one.

The same issue is also causing the UNIMPLEMENTED error in the question

So my solution is 1) put saaj-impl in classpath. If you are using maven, put the dependency on pom.xml

2) in weblogic.xml (in your resources folder) put

    <wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>com.sun.xml.messaging.saaj.*</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>

3) Restart your server through Node Manager and by right the CXF WS-Security should be working

Hope it helps!

like image 70
Joshua H Avatar answered Oct 05 '22 12:10

Joshua H