简体   繁体   中英

Java 11 + Tomcat 9 = java.lang.module.FindException: Module java.xml.bind not found

I recently upgraded to Mint 19 and came back to a mini Java project running on Tomcat.

When I start Tomcat, I'm seeing:

Using CATALINA_BASE:   /opt/apache-tomcat-9.0.17
Using CATALINA_HOME:   /opt/apache-tomcat-9.0.17
Using CATALINA_TMPDIR: /opt/apache-tomcat-9.0.17/temp
Using JRE_HOME:        /usr/lib/jvm/default-java
Using CLASSPATH:       /opt/apache-tomcat-9.0.17/bin/bootstrap.jar:/opt/apache-tomcat-9.0.17/bin/tomcat-juli.jar
Tomcat started.
java.lang.module.FindException: Module java.xml.bind not found
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.xml.bind not found
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
-Djava.endorsed.dirs=/opt/apache-tomcat-9.0.17/endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.xml.bind not found

I've spent a couple of hours trawling websites for how to fix this, but can't find a concrete answer.

I've tried popping a jaxb jar file into Tomcat's lib and also including it in the classpath. Nothing works.

If it helps, my jmods directory in my OpenJDK doesn't contain java.bind.xml. It only has java.xml.crypto.jmod and java.xml.jmod.

Is it meant to be part of the modular install or am I barking up the wrong tree?

Ignore this. I discovered a rogue environmental parameter in my.bashrc:

export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.xml.bind'

This was the source of the grief.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM