首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有JAXB和JAXWS的JDK11可以与Eclipse协同工作,但不能与IntelliJ协同工作

带有JAXB和JAXWS的JDK11可以与Eclipse协同工作,但不能与IntelliJ协同工作
EN

Stack Overflow用户
提问于 2019-05-16 12:14:49
回答 1查看 1.4K关注 0票数 0

我将使用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的一部分

代码语言:javascript
复制
<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

代码语言:javascript
复制
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集成开发环境中运行相同的代码会导致此错误

代码语言:javascript
复制
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不能?”

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-25 23:34:29

在IntelliJ的Roman Shevchenko的帮助下,我使用以下pom.xml解决了这个问题

代码语言:javascript
复制
    <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

代码语言:javascript
复制
requires java.xml.ws;
requires java.xml.bind;
requires javax.jws;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56160756

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档