I am getting an exception occurring that seems to be related to weaving not occurring and it is causing some for of persistence conflict/error, which is indicating the following…
[EL Severe]: 2024-08-09 11:04:24.92–ServerSession(1698237763)–Exception [EclipseLink-0] (Eclipse Persistence Services – 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
Exception [EclipseLink-199] (Eclipse Persistence Services – 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: In order to use Fetch Group, the domain class (class com.project.model.jpa.BoxerJPAImpl) has to implement FetchGroupTracker interface.
Descriptor: RelationalDescriptor(com.project.model.jpa.BoxerJPAImpl –> [DatabaseTable(BOXER)])
The Boxer entity/class is using the annotation @FetchGroups, and to my understanding, this requires weaving to have occurred and then you do not have to implement the FetchGroupTracker interface that is being indicated in the stack trace. When I implement the interface or remove the Fetchgroup annotation, I am able to launch.
But I also have a few error messages from Eclipse Link that appear before the exception that look like this
[EL Warning]: metadata: 2024-08-09 11:04:24.857–ServerSession(1698237763)–Reverting the lazy setting on the OneToOne or ManyToOne attribute [glove] for the entity class [class com.project.model.jpa.BoxerJPAImpl] since weaving was not enabled or did not occur.
So it seems like weaving did not occur or was not enabled so lazy settings are being reverted on OneToOne or ManyToOne attributes which then leads to the exception im getting about the FetchGroupTracker interface needing to be implement since no weaving happened. Now im new to weaving but to my understanding and what ive been able to find, we use Spring to enable load time weaving with the InstrumentationLoadTimeWeaver bean in our persistence.xml and in our VM options we also have a java agent pointing to the spring-instrument jar….which should enable weaving at load time?? At least to my understanding.
Here is the Bean in our xml
<context:load-time-weaver weaver-class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
I have also tried enabling the eclipselink.weaving=true jpa property as well but this doesn’t seem to work as well.
Also further down the stack there is a few more lines that I think lead to a clue as to whats going on. Several beans are having a problem being created and they all have this kind of stack trace
Constructor threw exception; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services – 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [persistenceUnit] failed. Close all factories for this PersistenceUnit.
I think some form of persistence error/conflict is happening behind the scenes that im having trouble identifying which is causing the entityManager not able to deploy due to the persistence unit failing. Sorry im kind of a newbie when it comes to eclipselink/JPA/Spring so I was just wondering if anyone had any ideas as to why im getting this exception and why weaving may not be occurring because ive tried for days to find an answer online and nothing is fixing the error.
Any help is appreciated 🙂
I have tried adding eclipselink weaving properties such as
eclipselink.weaving=true or eclipselink.weaving=static
Also since the exception indicated fetch groups, I tried
eclipselink.weaving.fetchgroups=true
Also tried adding the eclipselink.jar as another java agent because I read online that eclipselink requires that for weaving, but then I got an error about the class PersistenceUnitInfo not being present, although I can see it on the classpath.
I have tried different version of dependencies such as spring-instrument, eclipselink, aspectJ
Tried removing the loadTimeWeaving context bean from the Spring persistence.xml just to see if anything would happen and im still getting the same exception of weaving not occuring/enabled and needing to implement the FetchGroupTracker interface because of this, only when I remove the spring-instrument java agent does a new error occur. But this is essentially just stating it needs the java agent.