6

I'm getting the following error while starting my spring boot application

Caused by: org.springframework.ws.soap.SoapMessageCreationException: Could not create SAAJ MessageFactory: Unable to create SAAJ meta-factoryProvider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found; nested exception is javax.xml.soap.SOAPException: Unable to create SAAJ meta-factoryProvider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.afterPropertiesSet(SaajSoapMessageFactory.java:156)
    at org.springframework.ws.support.DefaultStrategiesHelper.instantiateBean(DefaultStrategiesHelper.java:182)
    ... 103 more
Caused by: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factoryProvider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
    at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:94)
    at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:138)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.afterPropertiesSet(SaajSoapMessageFactory.java:139)
    ... 104 more

Here is my dependency

        <dependency>
            <groupId>javax.xml.soap</groupId>
            <artifactId>saaj-api</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.messaging.saaj</groupId>
            <artifactId>saaj-impl</artifactId>
            <version>1.5.1</version>
        </dependency>

I'm the spring boot application in Java 17. Am I missing anything here?

DarkCrow
  • 785
  • 2
  • 8
  • 29
  • If anyone else finds this question you might want to check https://stackoverflow.com/a/66421487/158037 or other answers in that question. – user158037 Aug 18 '22 at 16:34

2 Answers2

2

For my Java 17 SoapMessageCreationException was solved with these dependencies

    <dependency>
        <groupId>javax.xml.soap</groupId>
        <artifactId>javax.xml.soap-api</artifactId>
        <version>1.4.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.messaging.saaj</groupId>
        <artifactId>saaj-impl</artifactId>
        <version>1.5.1</version>
    </dependency>
Dovile
  • 21
  • 2
  • I have upgraded the application to spring boot 3 and java 17. For me the SOAP APIs were working in eclipse but not in tomcat. After adding the above dependencies it worked for me in tomcat as well. Thank you. – Parul Feb 17 '23 at 17:47
0

The dependencies above helped to resolve the error below after upgrading to java 17 from java 11:

Caused by: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
            at java.xml/com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.java:439)
            at java.xml/com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java:230)
Rendz
  • 1
  • 1