问题描述
我的目标是将当前可与Java 8一起使用的Web服务应用程序迁移到Java11.由于已从JDK11中删除了JAXB和JAX-WS组件,因此有必要使用Maven或Jar添加适当的库.库.
My goal is to migrate a Web Services application that currently works with Java 8 to Java 11. Because the JAXB and JAX-WS components have been removed from JDK11, it is necessary to add the appropriate libraries, either using Maven or Jar libraries.
遇到类似问题的其他人有各种各样的建议,但是我找不到一个没有错误的组合.
There is a wide variety of recommendations and suggestions from others who have encountered similar issues, but I am not able to find a combination that does not have errors.
pom.xml
<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>
modules-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;
}
运行代码会产生此错误:
Running the code produces this error:
Unable to make field protected java.lang.String
com.agile.ws.schema.common.v1.jaxws.AgileUserUserGroupIdentifierType.classIdentifier accessible: module org.openfx.gustfx does not "opens com.agile.ws.schema.common.v1.jaxws" to unnamed module @4860d8d7
我如何找到这个未命名的模块?
How could I find this unnamed module ?
推荐答案
我能够通过添加
opens com.agile.ws.schema.common.v1.jaxws;
opens com.agile.ws.schema.project.v1.jaxws;
opens com.agile.ws.schema.search.v1.jaxws;
opens com.agile.ws.schema.collaboration.v1.jaxws;
到module-info.java.错误消息提示打开"应该针对特定的模块,但是显然这不是必需的
to the module-info.java. The error message suggested that the 'opens' should be to a specific module but apparently this is not required
这篇关于带有JAXB和JAXWS的JDK 11问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!