我将使用JAXB和JAX-WS的应用程序从JDK8转换到JDK11。当我使用Eclipse IDE时,代码会运行,但使用IntelliJ IDEA时,完全相同的代码会失败
我已经使用Eclipse和IntelliJ IDEA创建了一个Maven项目。寻找Maven资源的工作组合的问题已经在另一个问题中描述了。JDK 11 with JAXB and JAXWS problems在两种环境中都能正确地构建代码。我已经尝试将IntelliJ IDEA项目创建为Maven项目和标准IDEA项目
pom.xl的一部分
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0</version>
</dependency>
<!-- JAXWS for Java 11 -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.1</version>
</dependency>module-info.java
module org.openfx.gustfx {
requires javafx.controls;
requires javafx.fxml;
requires transitive javafx.graphics;
requires java.xml.bind;
requires java.xml.ws;
requires javax.jws;
opens com.agile.ws.schema.common.v1.jaxws to javafx.fxml;
opens org.openfx.gustfx to javafx.fxml;
exports org.openfx.gustfx;
}当代码从Eclipse运行时,没有任何错误。在IntelliJ集成开发环境中运行相同的代码会导致此错误
java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl通过搜索jar文件,可以确认ProviderImpl.class现在位于com.sun.ws.spi中,而不是com.sun.xml.internal.ws.spi中。这不会导致eclipse出现问题,但IDEA会报告ClassNotFoundException
因此,我的问题是“eclipse如何解决这个问题,而IntelliJ不能?”
发布于 2019-05-25 23:34:29
在IntelliJ的Roman Shevchenko的帮助下,我使用以下pom.xml解决了这个问题
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>和module-info.java
requires java.xml.ws;
requires java.xml.bind;
requires javax.jws;https://stackoverflow.com/questions/56160756
复制相似问题