Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink with spring giving error while loading descriptor xml(Eclipselink with spring giving error while loading descriptor xml)
Eclipselink with spring giving error while loading descriptor xml [message #1859089] Thu, 11 May 2023 09:26 Go to next message
Sanjana C is currently offline Sanjana CFriend
Messages: 31
Registered: December 2022
Member
Hi Team,

Iam using eclipselink 2.7.x with spring .

Iam getting below error while loading descriptor xml .


Caused by: java.lang.ClassCastException: class de.bund.bamf.InGe.bo.MigriertAttributeTransformer cannot be cast to class org.eclipse.persistence.mappings.transformers.AttributeTransf
ormer (de.bund.bamf.InGe.bo.MigriertAttributeTransformer is in unnamed module of loader org.springframework.instrument.classloading.SimpleThrowawayClassLoader @602ae7b6; org.eclipse.
persistence.mappings.transformers.AttributeTransformer is in unnamed module of loader 'app')

I think spring is not able to recognize classes in org.eclipse .* package.I have already set up weaving configuration to entity manager bean in spring-context.xml.


<property name="jpaPropertyMap">
<props>
<prop key="eclipselink.weaving">static</prop>
</props>
</property>
<property name="loadTimeWeaver">
<bean class=
"org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property
Is something am missing here?

Re: Eclipselink with spring giving error while loading descriptor xml [message #1859204 is a reply to message #1859089] Fri, 19 May 2023 00:56 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 54
Registered: December 2021
Member
Assuming your MigriertAttributeTransformer class extends EclipseLink's AttributeTransformer, this is likely the same problem/cause as in https://www.eclipse.org/forums/index.php/t/1112947/ where Spring is using multiple class loaders incorrectly so that your class loaded with one cannot be cast or used with EclipseLink classes loaded from another.

You'll need to look at how the class loaders are being setup in the Spring adapters used to load the project. I don't have enough experience to know what to look for or walk you through what might have gone wrong with your setup (I don't do it often, or at all if I can avoid it), but you might try in a debugger to step through where the error to see where it is thrown from as that might help show what or why a throwaway loader is being used for a class that is then cast against an app level one. It could also be you have multiple version of the EclipseLInk classes on the class path(s) some how.

Best Regards
Chris
Re: Eclipselink with spring giving error while loading descriptor xml [message #1861097 is a reply to message #1859204] Wed, 20 September 2023 13:15 Go to previous message
Sanjana C is currently offline Sanjana CFriend
Messages: 31
Registered: December 2022
Member
Hi Chris,

Actually the same thing was working with spring 2.5.6 and eclipselink 2.7.6

But it not working in spring 5.1.3 .

The difference i observed is SimpleThrowAwayClassLoader excludes org.eclipse.persistence packages in 2.5.6 but not in 5.1.3 .The error happens in EntityManagerSetupImpl.java while loading session.xml.
Do you have any idea on this as my project needs latest spring version to be used.

Thanks,
Sanjana
Previous Topic:Caching or Something else
Next Topic:Eclipselink generating sequence twice which is unexcepted
Goto Forum:
  


Current Time: Mon Apr 29 13:13:50 GMT 2024

Powered by FUDForum. Page generated in 0.02734 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top