There is a legacy but working application running on an old machine. I rebuilt it with existing Ant file. I put it on a new machine, and when I run the JAR file, I get this:
Exception in thread "main" java.lang.IllegalStateException: Cannot load configuration class: test.mybooker.config.ApplicationConfig
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:378)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:263)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at test.mybooker.batchjobs.RunJob.main(RunJob.java:48)
Caused by: java.lang.ExceptionInInitializerError
at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:166)
at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:116)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:108)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:104)
at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:112)
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:100)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:368)
... 6 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,ja va.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @774bd0a2
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:200)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:194)
at org.springframework.cglib.core.ReflectUtils$2.run(ReflectUtils.java:56)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at org.springframework.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:46)
... 17 more
What does it mean? What is likely the cause and how can I solve this?
Inside the ANT script, I have build
defined as such:
<target name="build" description="Compile main source tree java files and move needed resources">
<mkdir dir="${build.dir}" />
<javac destdir="${build.dir}" source="1.8" target="1.8" failonerror="true" debug="${compile.debug}">
<src path="${src.dir}" />
<classpath refid="master-classpath" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${res.dir}" />
</copy>
</target>
The source and target versions are 1.8. The JRE version to run the ANT script is JDK-18.0.1. Does that matter to this issue?