Hibernate OSGi 4.3.0.CR1 can't discover services

Description

Hibernate 4.2.7.SP1 was the first version that ran with transactions on the OSGi container JBoss Fuse 6 (thanks to HHH-8633). The current release candidate 4.3.0.CR1 does not.

There's been some changes to hibernate-osgi between 4.2.7.SP1 and 4.3.0.CR1, and Hibernate is no longer able to lookup the javax.transaction.TransactionManager from the service registry. The log claims that the TransactionManager is available, and we've verified that this is true with the debugger (by stopping all threads at the point Hibernate does the lookup and verify that a TransactionManager is available from the bundleContext). Hibernate fails with the exception

1 2 3 4 Caused by: org.hibernate.TransactionException: Cannot retrieve the TransactionManager OSGi service! at org.hibernate.osgi.OsgiJtaPlatform.retrieveTransactionManager(OsgiJtaPlatform.java:66) at org.hibernate.osgi.OsgiJtaPlatform.getCurrentStatus(OsgiJtaPlatform.java:113) at org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory.isJoinableJtaTransaction(CMTTransactionFactory.java:65)

Hibernate 4.3.0 use the ServiceTracker API from OSGi 4.3 which should be supported by the version of Apache Felix shipping with JBoss Fuse.

The test case attached explains how to set up an instance of JBoss Fuse 6 with hibernate and a sample application. The sample application was attached the RedHat support cased that spawned HHH-8633. It's therefore closer to a production environment than what's strictly necessary to illustrate this error.

Environment

Hibernate 4.3.0.CR1, Oracle 11g, JBoss Fuse 6

Status

Assignee

Brett Meyer

Reporter

Jostein Gogstad

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

4.3.0.CR1

Priority

Major