java Runtime error with module logic: java.lang.NoClassDefFoundError: javax/xml/ws/Service
java Runtime error with module logic: java.lang.NoClassDefFoundError: javax/xml/ws/Service
自从我迁移到 jdk9 后,我在运行时遇到以下错误:
java.lang.NoClassDefFoundError: javax/xml/ws/Service
我没有遇到编译错误,只有运行时错误。
模块信息如下:
module CXFPExGenCaller {
requires java.xml;
requires java.logging;
requires java.xml.bind;
requires java.xml.ws;
exports ......;
}
并且 pom.xml 包含以下依赖项:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.12-b141001.1542</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
<scope>test</scope>
</dependency>
即使我尝试了不同的配置,最终的结果仍然是这个恼人的错误!
有人知道这里发生了什么吗?
我已经明白我犯的错误了,尝试了以下答案:
我正在使用 JUnit 在 IntelliJ IDE 上测试我的 class,我只设置了编译器选项,而不是设置运行时的 VM 选项,如下图所示:
我不确定这是最佳做法,但这解决了我当前的问题
自从我迁移到 jdk9 后,我在运行时遇到以下错误:
java.lang.NoClassDefFoundError: javax/xml/ws/Service
我没有遇到编译错误,只有运行时错误。 模块信息如下:
module CXFPExGenCaller {
requires java.xml;
requires java.logging;
requires java.xml.bind;
requires java.xml.ws;
exports ......;
}
并且 pom.xml 包含以下依赖项:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.12-b141001.1542</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
<scope>test</scope>
</dependency>
即使我尝试了不同的配置,最终的结果仍然是这个恼人的错误! 有人知道这里发生了什么吗?
我已经明白我犯的错误了,尝试了以下答案:
我正在使用 JUnit 在 IntelliJ IDE 上测试我的 class,我只设置了编译器选项,而不是设置运行时的 VM 选项,如下图所示: