【发布时间】:2019-05-13 05:02:22
【问题描述】:
我的目标是将当前使用 Java 8 的 Web 服务应用程序迁移到 Java 11。由于 JAXB 和 JAX-WS 组件已从 JDK11 中删除,因此有必要使用 Maven 或 Jar 添加适当的库图书馆。
遇到类似问题的其他人提出了各种各样的建议和建议,但我无法找到没有错误的组合。
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;
}
运行代码会产生这个错误:
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
我怎样才能找到这个未命名的模块?
【问题讨论】:
-
您能否扩展问题以包括一些堆栈跟踪?否则无法判断是什么代码试图访问模块中的类成员。
-
This accepted answer 到 SO 问题 "Replacements for deprecated JPMS modules with Java EE APIs" 建议在 pom.xml 中为 JAXB 和JAX-WS。
<artifactId>for JAX-WS 与 OP 中的不同。 -
@skomisa 如问题所述,我已经为 JAXB 和 JAX-WS 尝试了许多 pom.xml 条目的组合,包括该答案“Replacements for deprecated JPMS modules with Java EE APIs”中的许多建议"发现总是有问题。我的问题中的组合是我唯一找到工作的组合。我已针对那篇文章发表了评论