Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354678 - Temp classloader is still being used during metadata processing
Summary: Temp classloader is still being used during metadata processing
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Guy Pelletier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-12 17:32 EDT by Michael Keith CLA
Modified: 2022-06-09 10:04 EDT (History)
5 users (show)

See Also:


Attachments
Proposed changes (113.29 KB, patch)
2012-05-25 13:22 EDT, Guy Pelletier CLA
no flags Details | Diff
Updated changes (122.15 KB, patch)
2012-05-30 10:04 EDT, Guy Pelletier CLA
no flags Details | Diff
Update to previous patch to correct nightly wdf test failures. (3.53 KB, patch)
2012-06-01 10:37 EDT, Guy Pelletier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Keith CLA 2011-08-12 17:32:57 EDT
Customer was using Gemini JPA with OSGi and encountered the logged exception below.

The java.lang.Integer class is not able to be found because the temp class loader is being used at metadata processing time, and in OSGi the temp loader is not being initialized to a useful loader (since it is not supposed to be needed anymore).  The method that does a Java classload is DirectCollectionAccessor.processDirectMapMapping(), which calls into ORMetadata.getJavaClass() and tries to load the class using the temp loader.

Guy suggested that perhaps a better fix would be to short circuit the  ORMetadata.getPrimitiveClassForName() method called by ORMetadata.getJavaClass(), and that that does not return the class because the upgrade to the new ASM version in 2.3.0 now returns a fully qualified class String instead of the unqualified name. If this is true then things will work as long as the class to be loaded is always a primitive, but the problem will still exist if the target class is a non-primitive.

Log: 

...

[EL Finest]: 2011-08-12 11:31:23.609--ServerSession(1508249638)--Thread(Thread[Refresh Packages,5,main])--Begin predeploying Persistence Unit Proteus; session Proteus; state Initial; factoryCount 0
[EL Finest]: 2011-08-12 11:31:23.635--ServerSession(1508249638)--Thread(Thread[Refresh Packages,5,main])--property=eclipselink.orm.throw.exceptions; default value=true
...


[EL Config]: 2011-08-12 11:31:27.033--ServerSession(1508249638)--Thread(Thread[Refresh Packages,5,main])--The value column name for the basic collection/map mapping element mapping element [attributes] is being defaulted to: ATTRIBUTES.
[EL Config]: 2011-08-12 11:31:27.038--ServerSession(1508249638)--Thread(Thread[Refresh Packages,5,main])--metadata_default_collection_table_schema (There is no English translation for this message.)
[EL Config]: 2011-08-12 11:31:27.038--ServerSession(1508249638)--Thread(Thread[Refresh Packages,5,main])--The primary key column name for the mapping element [field coverageMap] is being defaulted to: OID.
[EL Finest]: 2011-08-12 11:31:27.049--ServerSession(1508249638)--Thread(Thread[Refresh Packages,5,main])--End predeploying Persistence Unit Proteus; session Proteus; state PredeployFailed; factoryCount 0

!ENTRY org.eclipse.osgi 4 0 2011-08-12 11:31:27.053
!MESSAGE An unexpected runtime error has occurred.
!STACK 0
javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [Proteus] failed.
Internal Exception: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.lang.Integer]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/lang/Integer
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1385)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:306)
	at org.eclipse.gemini.jpa.provider.GeminiOSGiInitializer.initializeFromBundle(GeminiOSGiInitializer.java:119)
	at org.eclipse.gemini.jpa.provider.EclipseLinkOSGiProvider.assignPersistenceUnitsInBundle(EclipseLinkOSGiProvider.java:191)
	at org.eclipse.gemini.jpa.PersistenceBundleExtender.tryAssigningPersistenceUnitsInBundle(PersistenceBundleExtender.java:172)
	at org.eclipse.gemini.jpa.PersistenceBundleExtender.bundleChanged(PersistenceBundleExtender.java:314)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1522)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1458)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1453)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:485)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:251)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:173)
	at java.lang.Thread.run(Thread.java:680)
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [Proteus] failed.
Internal Exception: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.lang.Integer]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/lang/Integer
	at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:221)
	... 17 more
Caused by: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.lang.Integer]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/lang/Integer
	at org.eclipse.persistence.exceptions.ValidationException.unableToLoadClass(ValidationException.java:1949)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataHelper.getClassForName(MetadataHelper.java:111)
	at org.eclipse.persistence.internal.jpa.metadata.ORMetadata.getJavaClass(ORMetadata.java:273)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.DirectCollectionAccessor.processDirectMapMapping(DirectCollectionAccessor.java:446)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ElementCollectionAccessor.process(ElementCollectionAccessor.java:737)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processDirectCollectionAccessors(MetadataProject.java:1388)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1659)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:521)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:526)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1320)
	... 16 more
Caused by: java.lang.ClassNotFoundException: java/lang/Integer
	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:119)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataHelper.getClassForName(MetadataHelper.java:97)
	... 24 more
Comment 1 Tom Ware CLA 2011-08-24 10:13:03 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Guy Pelletier CLA 2012-05-25 13:22:53 EDT
Created attachment 216309 [details]
Proposed changes
Comment 3 Guy Pelletier CLA 2012-05-30 10:04:10 EDT
Created attachment 216479 [details]
Updated changes

After initial review from Tom Ware and input from Andrei Ilitchev.
Comment 4 Guy Pelletier CLA 2012-05-30 11:45:45 EDT
Changes have been submitted to the 2.4 stream and trunk

Verified by: Tom Ware with input from Andrei Ilitchev, James Sutherland, Peter Krogh

Tests: No new tests, existing FullRegressionTestSuite and extended jpa tests passed successfully.
Comment 5 Guy Pelletier CLA 2012-06-01 10:37:59 EDT
Created attachment 216663 [details]
Update to previous patch to correct nightly wdf test failures.
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:04:43 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink