JAVA - com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
Asked Answered
S

6

10

I'm working on an application that consumes a web service using SOAP requests.

Sometimes I get this error:

filters.LoggerFilter:92 - org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.Error: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factoryProvider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found

The weird part is that I get this error randomly, but I can't seem to figure out the cause.

I even added a new dependency, but it doesn't seem to correct the issue:

    <dependency>
        <groupId>com.sun.xml.messaging.saaj</groupId>
        <artifactId>saaj-impl</artifactId>
        <version>1.3</version>
    </dependency>
Showman answered 19/12, 2017 at 12:27 Comment(6)
just suggestion : upgrade your saaj-impl version 1.3 to 1.4.0Lyophobic
@Lyophobic already tried, still the sameShowman
probably about your cache. which ide use ?please check thisLyophobic
@Lyophobic thank you, I'm using IntelliJ IDEAShowman
I checked the dependency cache (saaj-impl-1.3.jar) and there is no "internal" namespace. StrangeKomi
Hi, What JDK were you using? Things change with Java 9 onwardsJuliojulis
E
17

I just had the same problem while using Java 11 to create an application that consumes SOAP-requests.

I added the new dependency and it worked fine for me.

<dependency>
    <groupId>com.sun.xml.messaging.saaj</groupId>
    <artifactId>saaj-impl</artifactId>
    <version>1.5.1</version>
</dependency>
Enrichetta answered 30/4, 2019 at 13:14 Comment(1)
I needed to add -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl to the java command in Java 11Load
M
4

For me, I was using Java 13 and the following worked for me(add these in the pom.xml)

    <dependency>
        <groupId>org.glassfish.metro</groupId>
        <artifactId>webservices-rt</artifactId>
        <version>2.4.4</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.metro</groupId>
        <artifactId>webservices-api</artifactId>
        <version>2.4.4</version>
    </dependency>
Mandymandych answered 1/3, 2021 at 11:40 Comment(2)
Tried many things but this worked for java11Sen
Thank you very much! You saved my day :) I just want to add that this config works for Java 13. But don't try to update versions of these packages! Just copy as it is with versions 2.4.4. Because newer packages not working for Java 13.Ear
S
2

For those who face this issue in intellij IDEA using Spring Boot under Java SDK 9+, you have to include explicitly --add-modules java.se.ee in VM parameters (edit configurations -> VM options). This answer may help to resolve other importing issues related to new Java Modules

Soviet answered 1/10, 2018 at 8:45 Comment(0)
P
2

With open JDK 17 and spring boot 3.0.1, I was getting the same issue. It got resolved by adding these dependencies in pom.xml

<dependency>
       <groupId>org.glassfish.metro</groupId>
       <artifactId>webservices-rt</artifactId>
       <version>2.4.4</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.metro</groupId>
        <artifactId>webservices-api</artifactId>
        <version>2.4.4</version>
    </dependency>
Predecessor answered 7/2, 2023 at 17:8 Comment(0)
I
1

I had the same problem. For me, adding saaj-impl was not enough to get rid of the exception

<dependency>
    <groupId>com.sun.xml.messaging.saaj</groupId>
    <artifactId>saaj-impl</artifactId>
    <version>1.5.2</version>
</dependency>

I had to also add saaj-api which fixed it finally:

<dependency>
    <groupId>javax.xml.soap</groupId>
    <artifactId>saaj-api</artifactId>
    <version>1.3.5</version>
</dependency>

Since I realised that my application was using saaj-api 1.3.4 after checking with command, upgrading to 1.3.5 helped

mvn dependency:tree -Dverbose

Iridissa answered 30/8, 2020 at 3:35 Comment(0)
F
0

Change your project sdk as Java 1.8

If you are using import javax.xml.ws library it could be confusing com.sun.xml.messaging.saaj dependency in Java 11. Clearing saaj dependency then using Java8 may be a solution in this issue

Fluxion answered 8/6, 2021 at 11:1 Comment(4)
Can you please elaborate why this should solve the problem?Loper
If you are using import javax.xml.ws library it could be confusing com.sun.xml.messaging.saaj dependency in Java 11. Clearing saaj dependency then using Java8 may be a solution in this issueFluxion
can you please add it as part of your answer?Loper
I had the same problem with java 8, and is packaging my application as war and deploying to Tomcat 9. remove, if added, saaj-impl, saaj-api and jaxws-api from pom. and add cxf-rt-frontend-jaxrs depedency. this should fix your problem. try doing pom-> maven-> reload project to be sure that jars are refreshed.Verity

© 2022 - 2024 — McMap. All rights reserved.