Getting below error after migrating standalone java application from Java8 to JDK11.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandler
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
Understand JDK11 doesn’t have jre included so using jlink created custom jre image but it seems module java.se.ee is deprecated in jdk11 and so java.xml.bind is not working.
Options which I already tried and didn’t work.
1.Included dependency jars to classpath - Ignore classpath arguments.I found same issue reported here - Run an executable JAR with external class path.
2.Configure module.info - Failing with error "accessible from more than one module”.I found same issue reported here - Eclipse is confused by imports ("accessible from more than one module").
I see many suggestion to convert the project to Maven and adding dependency jars to pom. The application is standard java batch application which gets triggered by source system.There are number of main class which gets executed based on the class name and arguments passed and i think through maven we can’t call multiple main classes.
I am looking for a solution where image of jre created using jlink work for this java application.