无法创建SOAP连接工厂:找不到提供程序com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory

时间:2018-11-12 10:06:51

标签: java eclipse maven soap

我目前正在开发一个Java服务器应用程序,该应用程序使用SOAP连接到另一台服务器,检索一些数据并将其存储到数据库中。 我从事Eclipse Photon的Maven项目。

到目前为止,我的Soap客户端运行良好。对于我的数据库存储功能,我需要JDBC SQL Server驱动程序。但是Eclipse告诉我,驱动程序是使用更新版本的Java编译的。

我使用的是Java 8,我已更新为Java 10,现在该驱动程序可以正常运行,但是我的SOAP客户端不再可用! Eclipse无法识别我用于Soap的 import javax.xml.soap

所以我将一些依赖项放入了pom.xml中,例如:

<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>

Eclipse似乎再次识别了javax的导入,因此我用Tomcar编译了我的项目以启动它,并在尝试使用Soap客户端后,它给了我以下错误:

  

java.lang.Exception:无法创建SOAP连接工厂:Provider com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory未找到

2 个答案:

答案 0 :(得分:0)

我有同样的情况,这是我解决的方法:

我下载了saaj-impl jar和mimepull依赖项 https://jar-download.com/artifacts/com.sun.xml.messaging.saaj/saaj-impl/1.3.6/source-code

我通过File-> Project Structure-> Modules-> Dependencies

将这两个jar作为依赖项导入到intelliJ中。

然后我将Maven依赖项添加到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>

关闭项目并重新打开后,我不再遇到丢失的soapconnectionfactory类错误!

答案 1 :(得分:0)

将此依赖项添加到我的POM中解决了此问题:

0

它还解决了以下错误:$sites = Sites::with(['AccessPoints' => function($query) { $query->where('status', '=', 'production'); }]) ->with('AccessPoints.Associations') ->orderBy('name', 'asc') ->get();