Failing test with JDK 10+ on Tomcat 8 (CommonExecutorServicesConfigurationTest) crashes while trying to set value to a field on this line with following error:
java.lang.IllegalArgumentException: Can not set org.jboss.weld.manager.BeanManagerImpl field org.jboss.weld.environment.servlet.test
|
Which, accordingly to javadoc corresponds to: If the specified object argument is not an instance of the class or interface declaring the underlying field, the method throws an IllegalArgumentException. Checking the classloaders for given instances (e.g. calling getClass().getClassloader()), on JDK 10 I can see following:
- Field accessibleField was loaded by - Launcher$AppClassLoader (uppermost system CL)
- Object instanceToInject was loaded by - ParallelWebappClassLoader (some other CL coming from Tomcat)
Whereas on JDK 8 we have:
- Field accessibleField was loaded by - ParallelWebappClassLoader
- Object instanceToInject was loaded by - ParallelWebappClassLoader
I suspect the TCCL (thread context class loader) issue in {{ForkJoinPool} (see linked Java issue in WELD-2494) but I am not sure how to verify and/or fix this yet. Ideas are welcome |