Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] NoSuchMethodError on <init> with dynamic weaving

I am using EclipseLink 2.3.2 and trying to write unit tests using embedded OpenEJB / TomEE.  I configured dynamic weaving by including my EclipseLink jar as a javaagent and adding these properties:

		props.put("eclipselink.weaving", "dynamic");
		props.put("eclipselink.weaving.lazy", "true");
		props.put("eclipselink.weaving.internal", "true");

When I run it I can see in the log messages that it is using weaving:

[EL Finest]: ServerSession(66487094)--Thread(Thread[main,5,main])--property=eclipselink.weaving.changetracking; default value=true
[EL Finest]: ServerSession(66487094)--Thread(Thread[main,5,main])--property=eclipselink.weaving.lazy; value=true
[EL Finest]: ServerSession(66487094)--Thread(Thread[main,5,main])--property=eclipselink.weaving.eager; default value=false
[EL Finest]: ServerSession(66487094)--Thread(Thread[main,5,main])--property=eclipselink.weaving.fetchgroups; default value=true
[EL Finest]: ServerSession(66487094)--Thread(Thread[main,5,main])--property=eclipselink.weaving.internal; value=true

and

[EL Finer]: ServerSession(66487094)--Thread(Thread[main,5,main])--Class [com.xxx.RequestForClassPublic] registered to be processed by weaver.

But on the first query, I get this error:

SEVERE: EjbTransactionUtil.handleSystemException: com.xxx.AbstractModifiableEntity.<init>(Lorg/eclipse/persistence/internal/descriptors/PersistenceObject;)V
java.lang.NoSuchMethodError: com.xxx.AbstractModifiableEntity.<init>(Lorg/eclipse/persistence/internal/descriptors/PersistenceObject;)V
	at com.xxx.RequestForClassPublic.<init>(RequestForClassPublic.java)
	at com.xxx.RequestForClassPublic._persistence_new(RequestForClassPublic.java)
	at org.eclipse.persistence.internal.descriptors.PersistenceObjectInstantiationPolicy.buildNewInstance(PersistenceObjectInstantiationPolicy.java:30)
	at org.eclipse.persistence.descriptors.ClassDescriptor.selfValidationAfterInitialization(ClassDescriptor.java:3870)
	at org.eclipse.persistence.descriptors.ClassDescriptor.validateAfterInitialization(ClassDescriptor.java:5688)
	at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3547)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:526)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:676)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:634)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:284)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:279)
	at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:162)
	at org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:119)
	at org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:96)
	at org.apache.openejb.persistence.JtaEntityManager.proxyIfNoTx(JtaEntityManager.java:326)
	at org.apache.openejb.persistence.JtaEntityManager.createQuery(JtaEntityManager.java:280)

This entity class RequestForClassPublic inherits from an abstract entity class AbstractModifiableEntity, those are declared like this:

@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@EntityListeners(AbstractModifiableEntityListener.class)
public abstract class AbstractModifiableEntity implements Serializable {
    // ... bunch of stuff
    public AbstractModifiableEntity() {
    }
    // ... bunch of stuff
}

@Entity
@Table(name="request_for_class_public")
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public class RequestForClassPublic extends AbstractModifiableEntity implements Serializable, Inquiry {
    // ... bunch of stuff
    public RequestForClassPublic() {
        super();
    }
    // ... bunch of stuff
}

Note that both the superclass and subclass have a default constructor which I believe is what the exception is complaining about. I've omitted the ivars, methods, and other code from the entity classes since I don't think they're relevant.

These same entity classes work fine when deployed as an application to Glassfish 3.2 which has EclipseLink 2.3.2 built-in and supports dynamic weaving.  So it is something about the unit test configuration or OpenEJB / TomEE that is causing this problem.

This may be related to this issue, though this bug was fixed long ago:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=292385

Thanks in advance for any tips or guidance.

Randy






Back to the top