MappedSuperclass doesn't work with dynamic weaving [message #532914] |
Tue, 11 May 2010 14:37 |
Adrian Gygax Messages: 14 Registered: July 2009 |
Junior Member |
|
|
Hi!
I'm using EclipseLink 2.0.1 together with Spring's -javaagent:org.springframework.instrument-3.0.2.RELEASE.jar. Now I added my first MappedSuperclass to my model and there seems to be an issue with dynamic weaving not really weaving that MappedSuperclass.
Facts:
* No problem if using static weaving
* My mapped superclass is never passed to Spring's InstrumentationLoadTimeWeaver, so Eclipselink actually doesn't get a chance to weave its stuff in
Example:
@MappedSuperclass
public abstract class AbstractAuditableEntity {
...
}
@Entity
public class LocalizedMessage extends AbstractAuditableEntity {
...
}
As soon as I execute a query and Eclipselink tries to create an instance of LocalizedMessage I get an exception like this which tells me that weaving didn't ocurr:
Caused by: java.lang.NoSuchMethodError: com.beeline.bop.common.model.AbstractAuditableEntity.<init> (Lorg/eclipse/persistence/internal/descriptors/PersistenceOb ject;)V
at com.beeline.bop.common.model.localization.LocalizedMessage.<init >(LocalizedMessage.java)
at com.beeline.bop.common.model.localization.LocalizedMessage._ persistence_new(LocalizedMessage.java)
at org.eclipse.persistence.internal.descriptors.PersistenceObje ctInstantiationPolicy.buildNewInstance(PersistenceObjectInst antiationPolicy.java:30)
at org.eclipse.persistence.descriptors.ClassDescriptor.selfVali dationAfterInitialization(ClassDescriptor.java:3522)
at org.eclipse.persistence.descriptors.ClassDescriptor.validate AfterInitialization(ClassDescriptor.java:5250)
at org.eclipse.persistence.descriptors.ClassDescriptor.postInit ialize(ClassDescriptor.java:3244)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.initializeDescriptors(DatabaseSessionImpl.java:463)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.initializeDescriptors(DatabaseSessionImpl.java:406)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.postConnectDatasource(DatabaseSessionImpl.java:671)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.login(DatabaseSessionImpl.java:633)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryPro vider.login(EntityManagerFactoryProvider.java:230)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl. deploy(EntityManagerSetupImpl.java:369)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.getServerSession(EntityManagerFactoryImpl.java:151)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManager(EntityManagerFactoryImpl.java:195)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean .invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423 )
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean $ManagedEntityManagerFactoryInvocationHandler.invoke(Abstrac tEntityManagerFactoryBean.java:485)
at $Proxy15.createEntityManager(Unknown Source)
at org.springframework.orm.jpa.SharedEntityManagerCreator$Share dEntityManagerInvocationHandler.invoke(SharedEntityManagerCr eator.java:234)
at $Proxy18.createNamedQuery(Unknown Source)
at com.beeline.bop.persistence.localization.jpa.JPALocalizedMes sageDAO.findAll(JPALocalizedMessageDAO.java:82)
at com.beeline.bop.business.localization.impl.LocalizationServi ceImpl.populateMessageSource(LocalizationServiceImpl.java:96 )
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCa pableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapa bleBeanFactory.java:1536)
at org.springframework.beans.factory.support.AbstractAutowireCa pableBeanFactory.invokeInitMethods(AbstractAutowireCapableBe anFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCa pableBeanFactory.initializeBean(AbstractAutowireCapableBeanF actory.java:1409)
... 27 more
So, I don't know if this is an EclipseLink bug, a Spring bug or a bug when using a combination of both. Does anybody have any ideas?
Maybe a classloading problem and EclipseLink should make sure all classes in persistence.xml are actually loaded after persistence context initialization?
[Updated on: Tue, 11 May 2010 15:09] Report message to a moderator
|
|
|
|
|
Re: MappedSuperclass doesn't work with dynamic weaving [message #533358 is a reply to message #532914] |
Thu, 13 May 2010 14:03 |
|
>> * My mapped superclass is never passed to Spring's InstrumentationLoadTimeWeaver, so Eclipselink actually doesn't get a chance to weave its stuff in
Sounds like it could be a bug in Spring, it might not be considering @MappedSuperclasses for weaving. You might try logging a bug on Spring, and use static weaving as a workaround.
Note, that Spring also has a weaving issue that it does not allow instrumentation until the Spring context is accessed by your application. If you application has trigger the loading of any of the classes before this, then they will already be loaded and will not get weaved.
James : Wiki : Book : Blog : Twitter
|
|
|
|
Powered by
FUDForum. Page generated in 0.03242 seconds