Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349399 - EMF is not registered for already installed bundles after a restart
Summary: EMF is not registered for already installed bundles after a restart
Status: RESOLVED FIXED
Alias: None
Product: Gemini.JPA
Classification: RT
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.0.0 RC3   Edit
Assignee: Michael Keith CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 01:52 EDT by Lucas Galfaso CLA
Modified: 2011-07-17 20:19 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Galfaso CLA 2011-06-15 01:52:39 EDT
Build Identifier: 1.0.0.RC1

When starting Felix with a bundle that defines an EMF that is already installed, the EMF is registered only if the start level is lower than the start level of org.eclipse.gemini.jpa 

Reproducible: Always

Steps to Reproduce:
1. use Felix (did not tested this with Equinox)
2. install org.eclipse.gemini.jpa (and all the needed dependencies)
3. install a bundle that defines an EMF
4. set the start level of org.eclipse.gemini.jpa to 10, to the bundle that registers the EMF to 20 and to 1 to everything else
5. Stop Felix
6. Start Felix
Comment 1 Michael Keith CLA 2011-06-15 10:12:57 EDT
Thanks for reporting and for the reproduce steps, Lucas.

A couple of questions:

1. Which version of Felix are you using?

2. Are you using Gemini DBAccess? What is the start level of those bundles, 1?

3. I am a little unclear from the way that step 4 is worded:

"4. set the start level of org.eclipse.gemini.jpa to 10, to the bundle that
registers the EMF to 20 and to 1 to everything else"

I assume you mean the bundle containing the persistence unit is set to 20 (since the bundle that registers the EMF is actually the org.eclipse.gemini.jpa bundle).

4. What normally happens is that the persistence unit bundle gets refreshed. Are you not seeing this happen? Are you able to run with -DGEMINI_DEBUG set on the JVM command line and post the output, along with the output of an ss command?

Thanks.
Comment 2 Lucas Galfaso CLA 2011-06-15 12:07:58 EDT
Hi,
  1. I am using Felix 3.2.2 (this is the latest version AFAICT)
  2. Yes, I am using DBAccess, and it is at start level 1
  3. Here is a ps, and it should make it clear
-> ps
START LEVEL 100
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (3.2.2)
[   1] [Active     ] [    1] Apache Felix File Install (3.1.10)
[   2] [Active     ] [    1] EclipseLink JPA (2.2.0.v20110202-r8913)
[   3] [Active     ] [    1] Apache Felix Declarative Services (1.6.0)
[   4] [Active     ] [    1] Apache Felix Log Service (1.0.1)
[   5] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
[   6] [Active     ] [    1] Apache Felix Http Proxy (2.2.0)
[   7] [Active     ] [    1] Apache Felix Metatype Service (1.0.4)
[   8] [Active     ] [    1] Java Persistence API 2.0 (2.0.3.v201010191057)
[   9] [Active     ] [    1] Apache Felix Web Management Console (3.1.8)
[  10] [Active     ] [    1] EclipseLink Core (2.2.0.v20110202-r8913)
[  11] [Active     ] [    1] Apache Felix Http Whiteboard (2.2.0)
[  12] [Active     ] [    1] Apache Felix EventAdmin (1.2.12)
[  13] [Active     ] [    1] EclipseLink ASM (2.2.0.v20110202-r8913)
[  14] [Active     ] [    1] Apache Felix Web Console Event Plugin (1.0.2)
[  15] [Active     ] [    1] Shutdown Bundle (0.1.0)
[  16] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
[  17] [Active     ] [    1] Apache Felix Deployment Admin (0.9.0)
[  18] [Active     ] [    1] EclipseLink ANTLR (2.2.0.v20110202-r8913)
[  19] [Active     ] [    1] Apache Felix Dependency Manager (3.0.0)
[  20] [Resolved   ] [    1] Gemini JPA Dynamic Weaving Fragment (1.0.0.RC1)
[  21] [Active     ] [    1] osgi.enterprise (4.2.0.201003190513)
[  22] [Active     ] [    1] Apache Felix Http Bundle (2.2.0)
[  23] [Resolved   ] [    1] Apache Felix Security Provider (1.4.2)
[  24] [Active     ] [   20] User Service implementation using JPA Bundle (0.1.0.SNAPSHOT)
[  25] [Active     ] [    1] Apache Felix Http Jetty (2.2.0)
[  26] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.8)
[  27] [Active     ] [    1] Apache Derby JDBC (10.5.1.1)
[  28] [Active     ] [    1] Apache Felix Http Bridge (2.2.0)
[  29] [Active     ] [    1] Apache Felix Http Api (2.2.0)
[  30] [Active     ] [    1] Apache Felix Preferences Service (1.0.4)
[  31] [Active     ] [    1] Apache Felix Http Base (2.2.0)
[  32] [Active     ] [    1] osgi.cmpn (4.2.0.200908310645)
[  33] [Active     ] [    1] Apache Felix Web Console Memory Usage Plugin (1.0.2)
[  34] [Active     ] [    1] User interface Bundle (0.1.0.SNAPSHOT)
[  35] [Active     ] [    1] Gemini DBAccess (1.0.0.RC1)
[  36] [Active     ] [   10] Gemini JPA (1.0.0.RC1)

Bundle 24 is the one with this issue, bundle 36 is Gemini JPA. I also started Felix with a startlevel of 100 (do not know if this should make any difference or not, but I can test it if you think it does)

 4. If the persistence bundle is refreshed, everything works as expected :-)

MAVEN_OPTS="-DGEMINI_DEBUG" mvn com.themadhouse:maven-launch-osgi-plugin:0.1.1:start
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building bug-me 0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-launch-osgi-plugin:0.1.1:start (default-cli) @ bug-me ---
[INFO] Starting framework
-> Gemini DBAccess Derby starting
EclipseLinkProvider starting...
GeminiServicesUtil registering provider service for org.eclipse.persistence.jpa.PersistenceProvider
GeminiServicesUtil successfully registered provider service for org.eclipse.persistence.jpa.PersistenceProvider
GeminiExtender listening
GeminiExtender looking at existing bundles: 
  org.apache.felix.framework [0]
  org.apache.felix.fileinstall [1]
  org.eclipse.persistence.jpa [2]
  org.apache.felix.scr [3]
  org.apache.felix.log [4]
  org.apache.felix.shell.tui [5]
  org.apache.felix.http.proxy [6]
  org.apache.felix.metatype [7]
  javax.persistence [8]
  org.apache.felix.webconsole [9]
  org.eclipse.persistence.core [10]
  org.apache.felix.http.whiteboard [11]
  org.apache.felix.eventadmin [12]
  org.eclipse.persistence.asm [13]
  org.apache.felix.webconsole.plugins.event [14]
  com.themadhouse.shutdown [15]
  org.apache.felix.shell [16]
  org.apache.felix.deploymentadmin [17]
  org.eclipse.persistence.antlr [18]
  org.apache.felix.dependencymanager [19]
  org.eclipse.gemini.jpa.weaving [20]
  osgi.enterprise [21]
  org.apache.felix.http.bundle [22]
  org.apache.felix.framework.security [23]
  com.themadhouse.user-jpa [24]
  org.apache.felix.http.jetty [25]
  org.apache.felix.configadmin [26]
  org.apache.derby [27]
  org.apache.felix.http.bridge [28]
  org.apache.felix.http.api [29]
  org.apache.felix.prefs [30]
  org.apache.felix.http.base [31]
  osgi.cmpn [32]
  org.apache.felix.webconsole.plugins.memoryusage [33]
  com.themadhouse.user [34]
  org.eclipse.gemini.dbaccess.derby [35]
  org.eclipse.gemini.jpa [36]
EclipseLink Provider started
Extender - bundle event,  bundle=org.eclipse.gemini.jpa, event=STARTED
Extender - bundle event,  bundle=com.themadhouse.user-jpa, event=RESOLVED
Extender - bundle event,  bundle=com.themadhouse.user-jpa, event=STARTING
Extender - bundle event,  bundle=com.themadhouse.user-jpa, event=STARTED
Extender - bundle event,  bundle=org.apache.felix.framework, event=STARTED
[INFO] Framework started


The persistence unit was not started.


Just some more notes, if the start level of the persistent unit is smaller than the one for org.eclipse.gemini.jpa, everything works great, the problem is when they are the other way around.

Looking at org.eclipse.gemini.jpa.PersistenceBundleExtender it looks like there is an inconsistency between lookForExistingBundles and bundleChanged. In the first method, if a bundle is installed (but not resolved) then it is not refreshed nor tryAssigningPersistenceUnitsInBundle is called, but in bundleChanged, the "resolved" event is ignored, "starting" does not have the entire information about the persistence unit and "started" is also ignored. 

If you need any other information, please let me know
Comment 3 Michael Keith CLA 2011-07-07 09:45:31 EDT
Lucas, RC2 should fix your problem. Can you give it a try and confirm before I close this bug? Thanks.
Comment 4 Lucas Galfaso CLA 2011-07-17 13:44:57 EDT
I am not able to reproduce this issue with RC2. Huge thanks!
Comment 5 Michael Keith CLA 2011-07-17 20:19:36 EDT
Fixed in RC2 but advertised in coming RC3.