Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366017

Summary: ClassNotFoundException: java/sql/Timestamp on fields annotated with @Version
Product: [RT] Gemini.JPA Reporter: Krum Tsvetkov <krum.tsvetkov>
Component: CoreAssignee: Michael Keith <michael.keith>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: gunnar, kwesi
Version: 1.0.0   
Target Milestone: 1.1.0 M2   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Sample persistence bundle to reproduce the problem none

Description Krum Tsvetkov CLA 2011-12-08 07:31:07 EST
Created attachment 208089 [details]
Sample persistence bundle to reproduce the problem

When decorating a field of type java.sql.Timestamp or java.lang.Long with a @Version annotation, we receive the following predeployment exception:

javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [PersistenceBundle] failed.
Internal Exception: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.sql.Timestamp]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/sql/Timestamp
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1402)
	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:1523)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1459)
	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1454)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:487)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:253)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:173)
	at java.lang.Thread.run(Unknown Source)
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [PersistenceBundle] failed.
Internal Exception: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.sql.Timestamp]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/sql/Timestamp
	at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:221)
	... 17 more
Caused by: Exception [EclipseLink-7156] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Unable to find the class named [java.sql.Timestamp]. Ensure the class name/path is correct and available to the classloader.
Internal Exception: java.lang.ClassNotFoundException: java/sql/Timestamp
	at org.eclipse.persistence.exceptions.ValidationException.unableToLoadClass(ValidationException.java:1967)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataHelper.getClassForName(MetadataHelper.java:111)
	at org.eclipse.persistence.internal.jpa.metadata.ORMetadata.getJavaClass(ORMetadata.java:277)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.VersionAccessor.process(VersionAccessor.java:110)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.processMappingAccessors(MetadataDescriptor.java:1437)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappingAccessors(ClassAccessor.java:1482)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(EntityAccessor.java:1058)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:631)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1645)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:532)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:526)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1337)
	... 16 more
Caused by: java.lang.ClassNotFoundException: java/sql/Timestamp
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:119)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataHelper.getClassForName(MetadataHelper.java:97)
	... 26 more


The respective bundle works without problems, though, i.e. the EntityManagerFactoryBuilder gets registered and can be used.

Steps to reproduce:
- import the attached project
- create a "OSGI Framework" run configuration with EclipseLink 2.3.1, GeminiJPA 1.0.0 and Gemini DBAccess 1.0.0
- run this configuration
The exception shows up in the console, the persistence bundle is active, the EMFBuilder service is also registered.

In java SE case (no bundles, no Gemini JPA) the exception doesn't appear.
Comment 1 Michael Keith CLA 2012-06-04 11:58:59 EDT
I wanted to see if bug 354678 fixed this bug, so I tried build 2.4.0.v20120523-r11463, before Guy had checked in the bug fix, and I expected to get a failure. I didn't get a failure, though, so this bug might have been fixed in an even earlier build of EclipseLink.

Please let me know if this problem is still being encountered.
Comment 2 Michael Keith CLA 2012-07-19 14:24:43 EDT
Closing as this seems to have been fixed. Please reopen if problem reoccurs.