javaee / metro-jax-ws

https://javaee.github.io/metro-jax-ws/
Other
132 stars 68 forks source link

com.sun.tools has dependencies on modules that have been removed in JDK11 #1234

Closed LanceAndersen closed 6 years ago

LanceAndersen commented 6 years ago

This issue was previously tracked at: https://bugs.openjdk.java.net/browse/JDK-8190371

Use jlink to create a JDK with the Java EE modules removed. The basic command is following. $JAVA_HOME/bin/jlink --output --module-path $JAVA_HOME/jmods --add-modules

The value you specify to --output is the generated run-time image. That is what you'll zip up to test with. The value that you specify to --add-modules is a comma separated list of module names. The simplest might be to look at the MODULES property in $JAVA_HOME/release which has the list of the modules in the JDK. You can copy that list and remove any of the modules that you don't want. Note that the list in the release file is space separated so you need to replace this with a comma for jlink.

Removing these modules: jdk.rmic jdk.xml.bind (JAXB tools) jdk.xml.ws (JAX-WS tools) java.activation java.corba java.transaction java.xml.bind java.xml.ws java.xml.ws.annotation java.se.ee

That leaves the command at the following. $JAVA_HOME/bin/jlink --output --module-path $JAVA_HOME/jmods \ --addmodules java.se,jdk.httpserver,java.smartcardio,jdk.accessibility,jdk.internal.jvmstat,jdk.attach,jdk.charsets,\ jdk.compiler,jdk.crypto.ec,jdk.crypto.cryptoki,jdk.dynalink,jdk.internal.ed,jdk.editpad,jdk.hotspot.agent,\ jdk.incubator.httpclient,jdk.internal.le,jdk.internal.opt,jdk.internal.vm.ci,jdk.jartool,jdk.javadoc,jdk.jcmd,\ jdk.management.agent,jdk.management,jdk.jconsole,jdk.jdeps,jdk.jdwp.agent,jdk.jdi,jdk.jfr,\ jdk.jlink,jdk.jshell,jdk.jsobject,jdk.jstatd,jdk.localedata,jdk.management.cmm,jdk.management.jfr,\ jdk.management.resource,jdk.naming.dns,jdk.naming.rmi,jdk.net,jdk.pack,jdk.security.jgss,\ jdk.policytool,jdk.scripting.nashorn,jdk.scripting.nashorn.shell,jdk.sctp,jdk.security.auth,jdk.snmp,\ jdk.xml.dom,jdk.zipfs,oracle.desktop,oracle.net,jdk.unsupported

When you generate the image then use <output>/bin/java --list-modules to satisfy yourself that it has the list of modules that you expect.

sdfelts commented 6 years ago

The above comment no longer applies since the modules have already been removed in JDK11.

Testing on a JDK11 build that has the Java EE modules in SE removed. The following errors occurred.

[java] [java] Caused by: wsimport failed [java] [java] at com.sun.tools.ws.ant.WsTask2.execute(WsTask2.java:432) [java] [java] at com.sun.tools.ws.ant.WsImportBase.execute(WsImportBase.java:581) [java] [java] at com.sun.tools.ws.ant.WsImport.execute(WsImport.java:100) [java] [java] at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:52) [java] [java] at weblogic.wsee.tools.clientgen.jaxws.ClientGenImpl.execute(ClientGenImpl.java:214) [java] [java] ... 18 more [java] [java] [java] [java] Total time: 20 seconds [java] [java] [clientgen] error: module not found: java.xml.ws

The references to –add-modules are in

com/sun/tools/ws/wscompile/WsgenTool.java com/sun/tools/ws/wscompile/WsimportTool.java

After I hacked around that, I’m getting [java] [java] [clientgen] javac: option -Xbootclasspath/p: not allowed with target 1.11 [java] [java] [clientgen] compilation failed, errors should have been reported

bravehorsie commented 6 years ago

This will happen if jaxws-api jar is put on classpath instead on module path. java.xml.ws should be put on module-path / upgrade-module-path since JavaSE 9. module not found: java.xml.ws should not happen than. I will update the code in jaxws to look for observable modules and add java.xml.ws to module path only if available.