I'm new to Java, Optaplanner, and gradle, please excuse any ignorance.
I've inherited a plain java application built with gradle which used the API to set up the (fixed) solver configuration. I wanted to move the config to XML, so now have
SolverFactory<Project> solverFactory = SolverFactory.createFromXmlResource("blah.xml");
Solver<Project> solver = solverFactory.buildSolver();Running this on Windows 10 with
$ java --version
java 11.0.11 2021-04-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)gives
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/C:/blah.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future releaseOn MacOS with
% java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)I get
java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:294) ~[blah.jar:?]
...
at com.sun.xml.bind.v2.JAXBContextFactory.createContext(JAXBContextFactory.java:35) ~[blah.jar:?]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:358) ~[blah.jar:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:691) ~[blah.jar:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:632) ~[blah.jar:?]
at org.optaplanner.core.impl.io.jaxb.GenericJaxbIO.<init>(GenericJaxbIO.java:88) ~[blah.jar:?]
...which I assume is the same thing with illegal accesses disabled.
I've searched for this and not found any references to OptaPlanner, but various similar reports for other projects. The fixes seem to be different in each case and I've not been able to work out a common factor to apply here. They seem to mostly involve changes to JAXB implementation or libraries.
Can anyone advise what I need to do to fix this please (other than enable illegal accesses). I'm puzzled why other OptaPlanner users aren't seeing this as I thought XML configuration was usual - or is it just that the fix is obvious to anyone who has a clue?
Thanks for any advice.
Regards,
jjf