1

I have the following error:

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)

My code is:

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);

The application running under:

  • Java(TM) SE Runtime Environment (build 1.7.0_15-b33)

  • WebLogic Server 12.1.2.0.0

The error appeared after adding the following line into setDomainEnv:

set JAVA_OPTIONS=%JAVA_OPTIONS% -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl

I am trying to switch implementation of SAAj to saaj-impl-1.3.23.jar.

My question is: how to properly ask Weblogic to use provided SAAJ implementation instead of its own?

user770113
  • 73
  • 1
  • 2
  • 7

1 Answers1

0

This question gets asked often, the answer is to tell weblogic what version it should prefer in your weblogic/application.xml document:

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

That will force weblogic to use the saaj package in your ear APP-INF/lib directory. Check the Oracle docs here

Also see:

How to set order of jars in WebLogic?

Prevent Weblogic 12c from using system's slf4j binding

Weblogic Configuration - prefer-web-inf-classes

Community
  • 1
  • 1
Display Name is missing
  • 6,197
  • 3
  • 34
  • 46
  • Thank you for response. That problem seems to be resolved. But after that server fail with following exception: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message at com.sun.xml.messaging.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:1269) – user770113 Aug 29 '14 at 18:09
  • 1
    "Error during saving a multipart message" resolved by adding "set JAVA_OPTIONS=%JAVA_OPTIONS% -Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl" into setDomainEnv. Thank you. – user770113 Aug 29 '14 at 18:21