Unable to create SOAP connection factory: Provider com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory not found

Viewed 14241

I am currently developping a Java server app that connect to another server with SOAP, retrieve some data and store it into a DB. I work on Eclipse Photon, Maven project.

My Soap client worked perfectly fine until now. For my db storage functions, I needed the JDBC SQL Server driver. But Eclipse told me that driver was compiled with a more recent version of Java.

I was on Java 8, I updated to Java 10 and now the driver works fine BUT my SOAP client doesn't work anymore ! Eclipse doesn't recognize the import javax.xml.soap I use for my Soap.

So I put into my pom.xml some dependencies for it like :

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.soap/javax.xml.soap-api -->
<dependency>
    <groupId>javax.xml.soap</groupId>
    <artifactId>javax.xml.soap-api</artifactId>
    <version>1.4.0</version>
</dependency>

The import of javax seemed to be recognized again by Eclipse so I compiled my project with Tomcar to launch it and after trying my Soap client it gives me the following error :

java.lang.Exception: Unable to create SOAP connection factory: Provider com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory not found

2 Answers

Adding this dependency to my POM fixed the issue:

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

It also fixes this error: javax.xml.soap.SOAPException: Unable to create message factory for SOAP: Unable to create SAAJ meta-factory: Provider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found

I had this same scenario, here's how I fixed it:

I downloaded the saaj-impl jar and the mimepull dependency https://jar-download.com/artifacts/com.sun.xml.messaging.saaj/saaj-impl/1.3.6/source-code

I imported these two jars into intelliJ as a dependency via File -> Project Structure -> Modules -> Dependencies

Then I added the maven dependencies into pom.xml:

<!-- saaj-impl-1.3.16.jar maven dependency -->
<dependency>
    <groupId>com.sun.xml.messaging.saaj</groupId>
    <artifactId>saaj-impl</artifactId>
    <version>LATEST</version>
    <systemPath>${project.basedir}/(from project folder to jar file).../saaj-impl- 
    1.3.16.jar</systemPath>
    <scope>system</scope>
</dependency>

<!-- mimepull-1.7.jar maven dependency -->
<dependency>
    <groupId>org.jvnet.mimepull</groupId>
    <artifactId>mimepull</artifactId>
    <version>LATEST</version>
    <systemPath>${project.basedir}/(from project folder to jar file).../mimepull- 
    1.7.jar</systemPath>
    <scope>system</scope>
</dependency>

After closing the project and reopening, I stopped getting the missing soapconnectionfactory class error!

Related