I have this Java project (branch java11) that I am currently working with.
Today I upgraded from Java 8 to Java 17. I changed some code regarding security, ACLs and the EHCache since many components were deprecated.
My code now compiles, but it has a weird runtime error that I have never seen before:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/ICIQ/eChempad/configurations/database/DatabaseAccessBeans.class]: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1753) ~[spring-beans-6.0.0.jar:6.0.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.0.jar:6.0.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.0.jar:6.0.0]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.0.jar:6.0.0]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.0.jar:6.0.0]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.0.jar:6.0.0]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.0.jar:6.0.0]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1131) ~[spring-context-6.0.0.jar:6.0.0]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:906) ~[spring-context-6.0.0.jar:6.0.0]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.0.jar:6.0.0]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.2.jar:3.1.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-3.1.2.jar:3.1.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436) ~[spring-boot-3.1.2.jar:3.1.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-3.1.2.jar:3.1.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.2.jar:3.1.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.2.jar:3.1.2]
at org.ICIQ.eChempad.EChempadApplication.main(EChempadApplication.java:50) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
How can I deactivate Load Time Weaving?
Alternatively, how can I properly configure Load Time Weaving?
I am perhaps seeking an explanation about how Load Time Weaving affects my application. This is a thing that I did not configure so I do not know how to deactivate it.
What I tried is configure the Load Time Weaving with instructions that I found on the Internet such as annotating my main class with @EnableLoadTimeWeaving
and adding the dependency of AspectJ but I get this different error:
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @1a99ac49
What I am doing wrong? I do not understand what I need to do.