Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328978 - OSGI SRG failed with [java] javax.persistence.PersistenceException: No Persistence provider for EntityManager named fieldaccess
Summary: OSGI SRG failed with [java] javax.persistence.PersistenceException: No Persis...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Edwin Tang CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-28 16:24 EDT by Yiping Zhao CLA
Modified: 2022-06-09 10:07 EDT (History)
4 users (show)

See Also:


Attachments
Removes 2nd Manifest.mf and corrects config.ini (4.84 KB, patch)
2011-01-25 17:10 EST, Shaun Smith CLA
no flags Details | Diff
patch file (2.14 KB, application/octet-stream)
2011-01-27 16:03 EST, Edwin Tang CLA
no flags Details
patch file (3.98 KB, patch)
2011-02-10 14:44 EST, Edwin Tang CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yiping Zhao CLA 2010-10-28 16:24:15 EDT
The last good revision is 8409, it seems that it's related to Shaun's changes made recently.

run-test:
     [echo] Running test on jdbc:oracle:thin:@stame03.us.oracle.com:1521:TOPLINK
     [java] javax.persistence.PersistenceException: No Persistence provider for EntityManager named fieldaccess
     [java] 	at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
     [java] 	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:402)
     [java] 	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:385)
     [java] 	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.createEntityManager(JUnitTestCase.java:340)
     [java] 	at org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.NamedNativeQueryJUnitTest.testNamedNativeQuery(NamedNativeQueryJUnitTest.java:52)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] 	at java.lang.reflect.Method.invoke(Method.java:597)
     [java] 	at junit.framework.TestCase.runTest(TestCase.java:168)
     [java] 	at junit.framework.TestCase.runBare(TestCase.java:134)
     [java] 	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:466)
Comment 1 Shaun Smith CLA 2010-11-02 11:31:48 EDT
The recent change requires o.e.p.jpa.osgi to be started instead of o.e.p.jpa since o.e.p.jpa no longer contains an Activator. Update the test launch config to change which bundles are started.
Comment 2 Shaun Smith CLA 2011-01-25 17:10:40 EST
Created attachment 187585 [details]
Removes 2nd Manifest.mf and corrects config.ini

Not sure how this ever ran but there were two Manifest.mf files in two different META-INF folders.  The one in the root of the osgi.test folder contained the correct content and identified the persistence unit to test but was not included in the generated test bundle.  The one in resources/META-INF was the one included in the generated bundle but did not declare any persistence units.  I move the correct content to the resources/META-INF/Manifest.mf and deleted the unused one.

Also adjusted config.ini as per my previous comment.

This patch does not solve the problem entirely.  The tests are now running with logging on FINEST (see below) and I can see the fieldaccess persistence unit identified and processed by the EclipseLink OSGi code.  However no tests results are produced.

Someone familiar with these tests needs to walk through the test invocation because none seem to be run.


     [java] [EL Finest]: 2011-01-25 16:56:06.335--Thread(Thread[Start Level Even
t Dispatcher,5,main])--EclipseLink OSGi - examining bundle: org.eclipse.persiste
nce.jpa.osgi.test_11 (There is no English translation for this message.)
     [java] [EL Finest]: 2011-01-25 16:56:06.335--Thread(Thread[Start Level Even
t Dispatcher,5,main])--EclipseLink OSGi - registering services for PU fieldacces
s (There is no English translation for this message.)
     [java] [EL Finer]: 2011-01-25 16:56:06.35--Thread(Thread[Start Level Event
Dispatcher,5,main])--EclipseLink OSGi registered EMF service for fieldaccess (Th
ere is no English translation for this message.)
     [java] [EL Finer]: 2011-01-25 16:56:06.35--Thread(Thread[Start Level Event
Dispatcher,5,main])--EclipseLink OSGi registered EMF Builder service for fieldac
cess (There is no English translation for this message.)
Comment 3 Edwin Tang CLA 2011-01-27 11:28:18 EST
Changed the summary of the bug. Actually, the OSGi example runs fine after Yiping made changes on the config.ini per Shaun's instruction. But the OSGi SRG still fails.
Comment 4 Edwin Tang CLA 2011-01-27 16:03:27 EST
Created attachment 187778 [details]
patch file

1. Changed config.ini
2. Added the following line in MANIFEST.MF
JPA-PersistenceUnits: fieldaccess
3. Comment out 
org.eclipse.persistence.testing.tests.jpa.advanced.EntityManagerJUnitTestSuite, because it requires default Persistence provider
Comment 5 Edwin Tang CLA 2011-01-27 16:09:25 EST
Checked in the patch. 

Now you should be able to follow the steps to run the OSGi SRG:
1. Execute “ant” from trunk to build everything – runtime and tests
2. Execute “ant” from trunk\jpa\eclipselink.jpa.osgi.test to build test bundle.
3. Copy trunk\jpa\eclipselink.jpa.osgi.test\test.properties to your home  directory(e. g.,C:\Documents and Settings\<your_user_id>.ST-MDC), and edit it to have correct db login info. 
4. Execute “ant test-osgi-srg” to run the tests
Comment 6 Edwin Tang CLA 2011-01-27 16:12:16 EST
Now we get the following exception. 

Stack Trace:
============
An exception occurred trying clear the cache.

java.lang.RuntimeException: An exception occurred trying clear the cache.
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.clearCache(JUnitTestCase.java:253)
at org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.AdvancedJPAJunitTest.setUp(AdvancedJPAJunitTest.java:73)
at junit.framework.TestCase.runBare(TestCase.java:132)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:503)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
at org.eclipse.persistence.testing.framework.osgi.Activator.start(Activator.java:50)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:782)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:773)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:754)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:557)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:464)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:248)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:445)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:220)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:330)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ALL] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class org.eclipse.persistence.testing.models.jpa.cacheable.CacheableFalseEntity] uses a non-entity [class org.eclipse.persistence.testing.models.jpa.cacheable.CacheableProtectedEntity] as target entity in the relationship attribute [method getProtectedEntity].
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1166)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:101)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:309)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initialize(JPAInitializer.java:262)
at org.eclipse.persistence.jpa.osgi.PersistenceProvider.getInitializer(PersistenceProvider.java:91)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:71)
at org.eclipse.persistence.jpa.osgi.EMFServiceProxyHandler.createEMF(EMFServiceProxyHandler.java:107)
at org.eclipse.persistence.jpa.osgi.EMFBuilderServiceProxyHandler.invoke(EMFBuilderServiceProxyHandler.java:76)
at $Proxy1.createEntityManagerFactory(Unknown Source)
at org.eclipse.persistence.javax.persistence.osgi.OSGiProviderResolver.lookupEMFBuilder(Unknown Source)
at org.eclipse.persistence.javax.persistence.osgi.OSGiProviderResolver.createEntityManagerFactory(Unknown Source)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:430)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:406)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getServerSession(JUnitTestCase.java:397)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.clearCache(JUnitTestCase.java:251)
... 26 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ALL] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class org.eclipse.persistence.testing.models.jpa.cacheable.CacheableFalseEntity] uses a non-entity [class org.eclipse.persistence.testing.models.jpa.cacheable.CacheableProtectedEntity] as target entity in the relationship attribute [method getProtectedEntity].
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:219)
... 42 more
Caused by: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class org.eclipse.persistence.testing.models.jpa.cacheable.CacheableFalseEntity] uses a non-entity [class org.eclipse.persistence.testing.models.jpa.cacheable.CacheableProtectedEntity] as target entity in the relationship attribute [method getProtectedEntity].
at org.eclipse.persistence.exceptions.ValidationException.nonEntityTargetInRelationship(ValidationException.java:1329)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor.getReferenceDescriptor(RelationshipAccessor.java:464)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ObjectAccessor.processOneToOneForeignKeyRelationship(ObjectAccessor.java:615)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ObjectAccessor.processOwningMappingKeys(ObjectAccessor.java:674)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.OneToOneAccessor.process(OneToOneAccessor.java:147)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processOwningRelationshipAccessors(MetadataProject.java:1350)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1572)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:486)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:454)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1120)
... 41 more
Comment 7 Edwin Tang CLA 2011-02-10 14:44:40 EST
Created attachment 188719 [details]
patch file

1. Changed <package> target in jpa\eclipselink.jpa.osgi.test\build.xml to only package field-access-model
2. Created org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.OSGiTestSuite to only include the tests using fieldaccess as Persistence Unit
Comment 8 Edwin Tang CLA 2011-02-11 11:21:56 EST
Checked in the second patch into 2.3.0, and both patches into 2.2.1

Code reviewed by: Yiping Zhao
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:07:30 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink