Cleanly starting apps on Java 9 and earlier
Mark Thomas
markt at apache.org
Sat Jul 1 09:18:20 UTC 2017
Hi,
Apache Tomcat needs to add the following options when running on Java 9:
--add-modules=java.se.ee
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
The first is because it depends on javax.xml.ws.WebServiceRef and
javax.xml.ws.WebServiceRefs.
We could work around this by shipping our own implementations but that
sort of duplication should not be necessary.
The second and third are required by Tomcat's memory leak detection and
prevention code. In an ideal world, web applications wouldn't have
memory leaks. Unfortunately, the world isn't ideal and the memory leak
detection and prevention code has proven immensely valuable over the years.
The problem we have is that Tomcat needs to run on Java 9 though 6. If
the above options aren't provided, Java 6 through 8 are fine but on Java
9 at best the users see a bunch of errors and at worst Tomcat won't
start. If the above options are included, Java 9 is fine but then Tomcat
fails to start on Java 6 though 8.
What is the recommended approach for applications that need to use one
or more of the options above and need to start cleanly on multiple Java
versions including 9 and earlier using a single, common start-up script?
To date, Tomcat has always been Java version agnostic as long as at
least the minimum Java version as specified by the Java EE spec has been
used. We really don't want to have to change that.
Suggestions welcome.
Mark
More information about the jigsaw-dev
mailing list