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

Bug 337826

Summary: Virgo and problems with EclipseLink
Product: [RT] Virgo Reporter: Alex Blewitt <alex.blewitt>
Component: runtimeAssignee: Project Inbox <virgo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington
Version: 2.1.0.RELEASEFlags: glyn.normington: documentation+
Target Milestone: 3.0.0.M02   
Hardware: PC   
OS: All   
Whiteboard:

Description Alex Blewitt CLA 2011-02-22 08:52:41 EST
I'm raising this bug mostly as documentation of unexpected behavior rather than something I expect to see fixed. It occurs for both 2.1.0 and 3.0.0.M1.

Installing EclipseLink requires the presence of the javax.persitsence package from EclipseLink. This contains not only the javax.persistence API, but also some internal EclipseLink specific code as well. The packages are exported with ;jpa="2.0".

Virgo ships with com.springsource.javax.persistence, which doesn't export the ;jpa="2.0" alongside.

osgi.enterprise 4.2 has an Import-Package: javax.persistence, but doesn't specify the attribute
eclipselink.jpa has Import-Package: javax.persistence;jpa="2.0"

As a result, if you install osgi.enterprise before you install the javax.persistence then the automatic resolvers kick in and install the com.springsource version. osgi.enterprise then binds to that (instead of the EclipseLink package) which means bundles depending on both osgi.enterprise and eclipselink can't resolve.

The solution is to install javax.persistence first, then restart and install the others. It then binds correctly from there on.
Comment 1 Glyn Normington CLA 2011-02-22 10:42:57 EST
Thanks for this bug. We can certainly provide some documentation.

A suggestion: you could place EclipseLink's javax.persistence JAR in repository/usr and then add it to the initialArtifacts property described in the User Guide. This will make sure that the JAR is installed before any applications are deployed, thus avoiding the need to restart Virgo. Also, you'll be able to clean start Virgo if you need to without repeating any set up.
Comment 2 Alex Blewitt CLA 2011-02-22 12:22:34 EST
This kicked me into creating a plan which listed them in order. I use this to install javax.persistence ahead of org.osgi.enterprise and the org.eclipselink bundles, which works.
Comment 3 Glyn Normington CLA 2011-02-28 06:55:57 EST
Note that this plan approach will only succeed if another app which depends on javax.persistence isn't deployed first. If that happens, then the com.springsource javax.persistence bundle will be auto-installed and you'll be back to square one.

The initialArtifacts approach is not so fragile because it gets in before any applications are deployed. (You can put the EclipseLink javax.persistence at the start of the initialArtifacts list if it turns out other bundles need to be added to the list.)

I am considering adding a "known issue" to the Programmer Guide to cover this bug.
Comment 4 Glyn Normington CLA 2011-02-28 08:54:22 EST
Known issue added.