users@glassfish.java.net

Re: JPA: problems converting class names to classes?

From: <glassfish_at_javadesktop.org>
Date: Wed, 21 Jul 2010 08:23:57 PDT

The odd thing is that the EclipseLink logs indicate that EclipseLink finds AbstractType (the class in question) and transforms it (adds change tracking, etc.):
[code]
[#|2010-07-21T07:56:24.046-0700|FINEST|glassfish3.1|org.eclipse.persistence.session.file:/usr/local/glassfish-3.1b11/glassfish/domains/domain1/applications/lead-1.0-SNAPSHOT/lib/lead-ear-config-1.0-SNAPSHOT.jar_LEAD.weaver|_ThreadID=20;_ThreadName=Thread-1;ClassName=null;MethodName=null;|Begin weaver class transformer processing class [com/foobar/identity/jpa/AbstractType].|#]

[#|2010-07-21T07:56:24.047-0700|FINEST|glassfish3.1|org.eclipse.persistence.session.file:/usr/local/glassfish-3.1b11/glassfish/domains/domain1/applications/lead-1.0-SNAPSHOT/lib/lead-ear-config-1.0-SNAPSHOT.jar_LEAD.weaver|_ThreadID=20;_ThreadName=Thread-1;ClassName=null;MethodName=null;|Weaved change tracking (ChangeTracker) [com/foobar/identity/jpa/AbstractType].|#]

[#|2010-07-21T07:56:24.047-0700|FINEST|glassfish3.1|org.eclipse.persistence.session.file:/usr/local/glassfish-3.1b11/glassfish/domains/domain1/applications/lead-1.0-SNAPSHOT/lib/lead-ear-config-1.0-SNAPSHOT.jar_LEAD.weaver|_ThreadID=20;_ThreadName=Thread-1;ClassName=null;MethodName=null;|Weaved fetch groups (FetchGroupTracker) [com/foobar/identity/jpa/AbstractType].|#]

[#|2010-07-21T07:56:24.047-0700|FINEST|glassfish3.1|org.eclipse.persistence.session.file:/usr/local/glassfish-3.1b11/glassfish/domains/domain1/applications/lead-1.0-SNAPSHOT/lib/lead-ear-config-1.0-SNAPSHOT.jar_LEAD.weaver|_ThreadID=20;_ThreadName=Thread-1;ClassName=null;MethodName=null;|End weaver class transformer processing class [com/foobar/identity/jpa/AbstractType].|#]

[#|2010-07-21T07:56:24.048-0700|INFO|glassfish3.1|javax.enterprise.system.core.classloading.com.sun.enterprise.loader|_ThreadID=20;_ThreadName=Thread-1;|com.foobar.identity.jpa.AbstractType actually got transformed|#]
[/code]

So it's there, and EclipseLink sees it during transformation, but then later on is unable to see it.

The "later on" bit is during metamodel analysis:
[code]
Caused by: Exception [EclipseLink-7198] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Class: [com.foobar.identity.jpa.AbstractType] was not found while converting from class names to classes.
Internal Exception: java.lang.ClassNotFoundException: com.foobar.identity.jpa.AbstractType
        at org.eclipse.persistence.exceptions.ValidationException.classNotFoundWhileConvertingClassNames(ValidationException.java:2352)
        at org.eclipse.persistence.descriptors.ClassDescriptor.convertClassNamesToClasses(ClassDescriptor.java:1224)
        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)
[/code]

(I use the metamodel at one point in an attempt to find an entity's name so that I can build a query on the fly--for reasons that aren't worth going into here, I can't use the CriteriaQuery functionality.)

(Lastly, AbstractType in my case is a @MappedSuperclass.)

So, is this a Glassfish classloading bug, or an EclipseLink error? Or have I unwittingly done something dumb? :-)

Best,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=478181