Arn*_*rno 5 java eclipse soap maven
我目前正在开发一个 Java 服务器应用程序,该应用程序使用 SOAP 连接到另一台服务器,检索一些数据并将其存储到数据库中。我从事 Eclipse Photon、Maven 项目。
到目前为止,我的 Soap 客户端运行良好。对于我的数据库存储功能,我需要 JDBC SQL Server 驱动程序。但是 Eclipse 告诉我驱动程序是用更新版本的 Java 编译的。
我使用的是 Java 8,我更新到 Java 10,现在驱动程序工作正常,但我的 SOAP 客户端不再工作了!Eclipse 无法识别我用于 Soap的导入 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>
Run Code Online (Sandbox Code Playgroud)
javax 的导入似乎再次被 Eclipse 识别,所以我用 Tomcar 编译了我的项目以启动它,在尝试我的 Soap 客户端后,它给了我以下错误:
java.lang.Exception:无法创建 SOAP 连接工厂:未找到提供程序 com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory
将此依赖项添加到我的 POM 解决了该问题:
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.4.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
它还修复了这个错误: 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
我遇到了同样的情况,这是我修复它的方法:
我下载了 saaj-impl jar 和 mimepull 依赖项 https://jar-download.com/artifacts/com.sun.xml.messaging.saaj/saaj-impl/1.3.6/source-code
我通过文件 -> 项目结构 -> 模块 -> 依赖项将这两个 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>
Run Code Online (Sandbox Code Playgroud)
关闭项目并重新打开后,我不再收到丢失的soapconnectionfactory类错误!
| 归档时间: |
|
| 查看次数: |
10240 次 |
| 最近记录: |