org.apache.axis.message.SOAPBodyElement无法强制转换为weblogic.xml.xmlnode.XMLNode

时间:2013-10-11 14:49:23

标签: java xml soap weblogic weblogic-10.x

我将所有jar都放在适当的位置,当我在weblogic服务器上部署我的application.war文件时,它总是尝试使用自己的jar用于SOAPBodyElement,因此我得到的例外情况如下 -

  

java.lang.ClassCastException:org.apache.axis.message.SOAPBodyElement无法强制转换为weblogic.xml.xmlnode.XMLNode ..

我的代码看起来像

MessageFactory mf = MessageFactory.newInstance(); 
SOAPMessage request = mf.createMessage();
SOAPPart part = request.getSOAPPart();
SOAPEnvelope env = part.getEnvelope();
SOAPBody body = env.getBody();
SOAPBodyElement soapBodyElement = new SOAPBodyElement(document);
body.addChildElement(soapBodyElement); // throws exception @ this line

只有来自org.apache.axis.message的SOAPBodyElement包全部来自javax.xml.soap包。有没有办法在不改变启动脚本的情况下覆盖我的代码中的weblogic首选项。或者添加childElement的任何其他解决方法?

请帮助我。

1 个答案:

答案 0 :(得分:0)

您可以通过更改weblogic.xml(在您的战争情况下)或weblogic-application.xml(如果是耳朵)来提及您首选的库。

对于weblogic.xml,您必须将prefer-web-inf-classes标记设置为true,以便它将从您的web-inf文件夹加载类

对于weblogic-application.xml,您可以定义prefer-application-packages标签

您可以参考此问题here

相关问题