Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337826 - Virgo and problems with EclipseLink
Summary: Virgo and problems with EclipseLink
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: runtime (show other bugs)
Version: 2.1.0.RELEASE   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.0.0.M02   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-22 08:52 EST by Alex Blewitt CLA
Modified: 2011-02-28 08:54 EST (History)
1 user (show)

See Also:
glyn.normington: documentation+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.