我有以下错误:
Exception: javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Message send failed: com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to oracle.j2ee.ws.saaj.soap.MessageImpl
at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call2(HttpSOAPConnection.java:234)
at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:141)
at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:134)
我的代码是:
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
soapMessage.getSOAPPart().getEnvelope().addNamespaceDeclaration("http://action.web.nnn.some.com/", "act");
SOAPElement elemement = soapMessage.getSOAPPart().getEnvelope().getBody().addChildElement("getSomeMethod", "http://action.web.nnn.some.com/").addChildElement("arg0");
elemement.addTextNode(someDate);
soapMessage.saveChanges();
SOAPMessage responce = SOAPConnectionFactory.newInstance().createConnection().call(soapMessage, wsdlUrl);
在:
下运行的应用程序Java(TM)SE运行时环境(版本1.7.0_15-b33)
WebLogic Server 12.1.2.0.0
将以下行添加到setDomainEnv后出现错误:
set JAVA_OPTIONS=%JAVA_OPTIONS% -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
我正在尝试将SAAj的实现切换为saaj-impl-1.3.23.jar。
我的问题是:如何正确地要求Weblogic使用提供的SAAJ实现而不是自己的实现?
答案 0 :(得分:0)
这个问题经常被问到,答案是在weblogic / application.xml文档中告诉weblogic它应该选择哪个版本:
<wls:prefer-application-packages>
<wls:package-name>com.sun.xml.messaging.saaj.*</wls:package-name>
</wls:prefer-application-packages>
这将迫使weblogic在您的耳朵APP-INF / lib目录中使用saaj包。查看Oracle文档here
另见:
How to set order of jars in WebLogic?