Unable to create SAAJ meta-factory in Java 17
Asked Answered
A

2

7

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?

Aniakudo answered 10/3, 2022 at 17:14 Comment(1)
If anyone else finds this question you might want to check https://mcmap.net/q/1047264/-java-com-sun-xml-internal-messaging-saaj-soap-saajmetafactoryimpl-not-found or other answers in that question.Whaley
B
4

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>
Broken answered 16/11, 2022 at 11:26 Comment(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.Sulphathiazole
Basis my experience, higher version of library of saaj-impl causes this issue , hence 1.5.0 and 1.5.1 works fineCoracorabel
C
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)
Carrissa answered 29/8, 2023 at 14:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.