gpt4 book ai didi

java - com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl 无法转换为 oracle.j2ee.ws.saaj.soap.MessageImpl

转载 作者:太空宇宙 更新时间:2023-11-04 14:36:03 27 4
gpt4 key购买 nike

我有以下错误:

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 服务器 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 实现而不是它自己的实现?

最佳答案

这个问题经常被问到,答案是告诉 weblogic 它应该在 weblogic/application.xml 文档中选择哪个版本:

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

这将强制 weblogic 使用您的ear APP-INF/lib 目录中的saaj 包。检查 Oracle 文档 here

另请参阅:

How to set order of jars in WebLogic?

Prevent Weblogic 12c from using system's slf4j binding

Weblogic Configuration - prefer-web-inf-classes

关于java - com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl 无法转换为 oracle.j2ee.ws.saaj.soap.MessageImpl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25553202/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com