2016-02-24 48 views
8

我們試圖使用CXF框架進行web服務調用,涉及CXF-ws安全性,應用程序正在部署在weblogic 10.3中,但接收在異常下面,看起來像weblogic特定的jar被拾取,儘管xercesimpl jar存在於/ WEB-INF/lib的應用程序中。CXF 3.0.2在weblogic10.3中拋出「java.lang.AssertionError:UNIMPLEMENTED」異常

選項嘗試過,但並沒有幫助:

  1. 與 WEB-INF喜好

真實場景weblogic的容器描述符。

  • 設置JVM參數或系統屬性作爲 -
  • -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. 將xercesimpl jar添加到maven pom。

      異常

      ]] 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.DOMXMLSignature.marshal(DOMXMLSignature。org.apache.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeNamespace(XmlWriterToTree.java:114) java:211) at org.apache.wss4j.dom.message.WSSecSignature.computeSignature org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(DOMXMLSignature.java:329) (WSSecSignature.java: 578) at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:151) at org.apache.wss4j.dom.handler.WSHandler.doSend erAction(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在org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor(WSS4JOutInterceptor.java:282) 在org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor $ WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:154) $ WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:141) 在org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)enter code here 在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)

      感謝, Soumya

    +0

    這篇文章實際上解決了我的問題http://cxf.547215.n5.nabble.com/Running-CXF-WSS4J-on-Weblogic-td5626091.html但我還在等待更好的答案。作者提到了一些我認爲可能會成爲問題的警告 –

    回答

    2

    我終於找到了,而無需修改任何WebLogic啓動腳本答案(上CXF 2.7.0測試和WebLogic 10.3.6

    這樣做的原因問題是,CXF不與WebLogic實現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.

    同樣的問題也導致未實現Ë在這個問題上的錯誤

    所以我的解決方案是 1)把saaj-impl放在classpath中。如果您正在使用maven,把依賴上的pom.xml

    2)在weblogic.xml(在你的資源文件夾中)把

    <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)通過節點管理器和右側的CXF重新啓動服務器WS-Security應該可以工作

    希望它有幫助!