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

Bug 335174

Summary: Hibernate fails to resolve with Virgo 2.1.0.RELEASE
Product: [RT] Virgo Reporter: Glyn Normington <glyn.normington>
Component: runtimeAssignee: Glyn Normington <glyn.normington>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dmitry
Version: 2.1.0.RELEASEFlags: glyn.normington: documentation+
Target Milestone: 3.0.0.M01   
Hardware: All   
OS: All   
URL: http://www.eclipse.org/forums/index.php?t=msg&th=202178&S=36542d2756cefdd94c8402e02c0dcffd#msg_646063
Whiteboard:

Description Glyn Normington CLA 2011-01-24 06:31:26 EST
The Hibernate EJB fragment imports slf4j with a version range that excludes the slf4j package provided with Virgo. The solution is to change the manifest of the Hibernate EJB fragment to widen the version range.
Comment 1 Glyn Normington CLA 2011-01-24 06:49:12 EST
The fix in the SpringSource Enterprise Bundle Repository is covered by https://issuetracker.springsource.com/browse/EBR-712.
Comment 2 Dmitry Sklyut CLA 2011-01-24 21:48:39 EST
I posted this comment on EBR jira - duplicating here:

It looks like problem is a bit more involved than just a version of slf4j.

There is a split packages between host com.springsource.org.hibernate-3.3.2.GA (A) bundle and fragments com.springsource.org.hibernate.annotation-3.4.0.GA (B) and com.springsource.org.hibernate.ejb-3.4.0.GA-A (C) all defining different versions.  I am not even sure why equinox allows these fragment bundles to resolve and attach to host at all.

For example:
A exports org.hibernate and org.hibernate.cfg with version="3.3.2.GA"
B exports org.hibernate and org.hibernate.cfg with version="3.4.0.GA"

And

B exports org.hibernate.ejb;version="3.4.0.GA"
C exports org.hibernate.ejb;version="3.4.0.GA-A"

Maybe fragments should not be exporting packages that are exported by host bundle?  It looks based on the generated manifest that there is Exclude-Imports bundlor header as I do not see imports for anything from hibernate other than org.hibernate.annotations.common (annotation-common).  Missing Exclude-Exports to mirror Exclude-Imports?

In version 3.5 hibernate merged annotations into core, but entity manager and annotation-common can still be obtained as a standalone module.  There is still a split package between hibernate-core and hibernate-entity-manager.

I would always "shade" all of the hibernate jars together and only deal with cache providers individually (ehchace, jbosscache, etc).
Comment 3 Dmitry Sklyut CLA 2011-01-24 21:51:59 EST
Forgot to add this:

With Import-Library: org.hibernate.ejb;version="[3.4.0.GA-A, 3.4.0.GA-A]"

This is the exception:


Caused by: org.eclipse.virgo.kernel.osgi.framework.ImportMergeException: cannot merge imports of package 'org.hibernate.ejb' from sources 'Import-Library 'org.hibernate.ejb' version '3.4.0.GA-A'(Import-Bundle 'com.springsource.org.hibernate.ejb' version '3.4.0.GA-A', Import-Bundle 'com.springsource.org.hibernate.annotations' version '3.4.0.GA')' because of disjoint package version ranges
Comment 4 Glyn Normington CLA 2011-02-08 05:00:35 EST
This is fixed by an update library [1] and some of the contained bundles. All the new versions have qualifiers ending in "-A". I tested that a bundle importing the updated library resolves ok under Virgo.

[1] http://ebr.springsource.com/repository/app/library/version/detail?name=org.hibernate.ejb&version=3.4.0.GA-A&searchType=librariesBySymbolicName&searchQuery=org.hibernate
Comment 5 Glyn Normington CLA 2011-02-28 10:42:21 EST
A known issue is now documented in the Virgo Programmer Guide.