JDK 11 with JAXB and JAXWS problems

自古美人都是妖i 提交于 2019-12-24 10:46:10

问题


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 ?


回答1:


I was able to solve this problem by adding

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;

to the module-info.java. The error message suggested that the 'opens' should be to a specific module but apparently this is not required



来源:https://stackoverflow.com/questions/56105992/jdk-11-with-jaxb-and-jaxws-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!