openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "reverttoconsole (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2003) java.lang.NoClassDefFoundError: (initialization failure) raised when @MappedSuperClass is present in a jar
Date Tue, 24 May 2011 15:48:47 GMT
java.lang.NoClassDefFoundError: (initialization failure) raised when @MappedSuperClass is present
in a jar
----------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-2003
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2003
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 1.2.2
         Environment: Spring 3.0x, JUnit 4.4
            Reporter: reverttoconsole


I have a @MappedSuperclass BaseEntity (empty) that's include in a common-utils.jar. In another
maven project, I have JPA 1.0 entities which extend BaseEntity. On running a unit test, I
get the following error:

Caused by: java.lang.NoClassDefFoundError: xxx.entity.ProfileLoadError (initialization failure)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
	at java.lang.Class.forNameImpl(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1522)
	at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1504)
	at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesLocking(MetaDataRepository.java:1491)
	at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1484)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:276)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:190)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
	at java.lang.reflect.Method.invoke(Method.java:612)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485)
	at $Proxy21.createEntityManager(Unknown Source)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:234)
	at $Proxy22.persist(Unknown Source)
	at org.frb.bos.tcms.profile.SeedData.afterPropertiesSet(SeedData.java:37)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
	... 37 more

If I move the BaseEntity into the maven project, I don't get this error.

Turns out that the error is gone when I include BaseEntity in persistence.xml. But it seems
to me that this has to be documented clearly or atleast the error message should be clearer
because NoClassDefFoundError is misleading. Maybe openjpa's classloader doesn't automatically
scan the classpath for the missing entities?

I don't get this error in hibernate.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message