How to enable java 9 module at runtime?

I have a server set that I am trying to test on the java9 JDK (here, I am using the 64-bit version of Linux), however, shortly after starting, I found the following error:

java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:533) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:186) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:476) 

Server suite starts without problems when using java8. Somehow I need to tell the runtime system to enable the javax.xml.bind module, however, I am new to java9 and do not know how to do this so as not to recompile the entire server suite into the module and add a dependency on javax.xml.bind . Is there a way to resolve this error, which does not require me to recompile the server suite into a module?

+5
source share
1 answer

Java EE modules come with the JDK, but are not enabled by default , and java.xml.bind is one of them. In such cases, they should be included explicitly with --add-modules .

In your case, run with --add-modules java.xml.bind .

+8
source

Source: https://habr.com/ru/post/1265705/


All Articles