8

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>
guidev
  • 2,545
  • 1
  • 21
  • 39

5 Answers5

10

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>
Amelie St.
  • 101
  • 1
  • 3
  • I needed to add -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl to the java command in Java 11 – Narayan Feb 19 '21 at 01:03
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

rahimli
  • 1,105
  • 10
  • 24
1

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>
Sam ツ
  • 513
  • 2
  • 6
  • 17
0

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

bahadir_g
  • 195
  • 1
  • 14
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

ebey
  • 35
  • 8
  • Can you please elaborate why this should solve the problem? – Genry Jun 08 '21 at 12:51
  • 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 – ebey Jun 09 '21 at 15:04
  • can you please add it as part of your answer? – Genry Jun 14 '21 at 08:54