Results 1 to 4 of 4

Thread: EclipseLink-7198: java.lang.ClassNotFoundException: Class was not found ...

  1. #1
    Join Date
    Dec 2009
    Posts
    11

    Default EclipseLink-7198: java.lang.ClassNotFoundException: Class was not found ...

    I'm using Spring 3.0.5 and GlassFish 3.0.1 with EclipseLink 2.1.1.v20100817-r8050.

    I have the following entity classes in the example:
    @MappedSuperclass class AbstractDataObject
    @MappedSuperclass class AbstractNamedDataObject extends AbstractDataObject
    @Entity class TestEntity extends AbstractNamedDataObject

    And the following Spring components that use the entity TestEntity:
    @Repository class TestRepositoryImpl
    @Service class TestServiceImpl

    When using a @MappedSuperclass parent class for an entity, accessing EntityManager.getCriteriaBuilder() in TestRepositoryImpl causes a ClassNotFoundException, when called from a @Transactional-annotated method in TestServiceImpl.

    Because I'm not sure whether Spring or EclipseLink is the root cause of this bug, I have filed a detailed bug report in EclipseLink bug database.

    For complete stack traces, logs and a test case, see the EclipseLink bug:
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=332290

    A stack trace snippet:
    Code:
    Caused by: Exception [EclipseLink-7198] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Class: [net.example.persistencetest.AbstractDataObject] was not found while converting from class names to classes.
    Internal Exception: java.lang.ClassNotFoundException: net.example.persistencetest.AbstractDataObject
    	at org.eclipse.persistence.exceptions.ValidationException.classNotFoundWhileConvertingClassNames(ValidationException.java:2362)
    	at org.eclipse.persistence.descriptors.ClassDescriptor.convertClassNamesToClasses(ClassDescriptor.java:1233)
    	at org.eclipse.persistence.internal.jpa.metamodel.MappedSuperclassTypeImpl.create(MappedSuperclassTypeImpl.java:89)
    	at org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl.create(ManagedTypeImpl.java:443)
    	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.initialize(MetamodelImpl.java:343)
    	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:101)
    	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:120)
    	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.getMetamodel(EntityManagerSetupImpl.java:1996)
    	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:495)
    	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getCriteriaBuilder(EntityManagerFactoryImpl.java:478)
    	at com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.getCriteriaBuilder(EntityManagerFactoryWrapper.java:109)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
    	at $Proxy188.getCriteriaBuilder(Unknown Source)
    	at net.example.persistencetest.TestRepositoryImpl.findAll(TestRepositoryImpl.java:24)
    	at net.example.persistencetest.TestServiceImpl.findAll(TestServiceImpl.java:37)
    	at net.example.persistencetest.TestServiceImpl.init(TestServiceImpl.java:30)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:340)
    	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:293)
    	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
    	... 59 more
    Caused by: java.lang.ClassNotFoundException: net.example.persistencetest.AbstractDataObject
    	at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:744)
    	at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
    	at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1656)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:247)
    	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:88)
    	at org.eclipse.persistence.descriptors.ClassDescriptor.convertClassNamesToClasses(ClassDescriptor.java:1230)
    	... 84 more

  2. #2
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    18

    Default

    Same problem here using Spring 3.0.5 and EclipseLink 2.0.1 and 2.1.1. It seems like Spring's agent does not like @MappedSuperclass.

  3. #3
    Join Date
    Dec 2009
    Posts
    11

    Default

    The bug is in EclipseLink and it's been fixed in EclipseLink 2.1.2, which was released recently.

  4. #4
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    18

    Default

    Thanks for your help! It seems that my problem is different from yours and upgrading EclipseLink to 2.1.2 does not solve it for me. As a workaround, I disabled weaving completely and not the error is gone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •