Hibernate OSGi 4.3.0.CR1 can't discover services


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

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.


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


Jostein Gogstad
December 3, 2013, 8:12 PM

Great. Let me know when hibernate-osgi is ready for testing and we'll try it out. We have some problems with our current ORM and we're eager to try Hibernate on OSGi.

Jostein Gogstad
December 5, 2013, 9:45 AM

I found some time to work more on this. After fixing the bug in OsgiServiceUtil (github commit), Hibernate starts. JBoss Fuse now crash on Aries, since Aries doesn't support JPA2.1. I see you branch at HHH-8160/https://github.com/brmeyer/aries/tree/jpa21, but I'm not able to build it.

Maven says

Internet point some migration problems in Maven 3 (link). I get the same error with Maven 2 though.

It would be easier to start using Hibernate OSGi if we could pull the fork of ARIES from somewhere. Not build it ourself and publish it to our local Nexus. I see you already have some snapshots of aries jpa at repository.jboss.org/nexus (link). Is it possible to publish your branch there as well?

Brett Meyer
December 5, 2013, 3:50 PM

, that's not necessarily an unreasonable request, but I'm checking with the Aries guys to coordinate. I'll let you know what I found out. In the meantime, would providing you with binaries help? Happy to do it if it continues to boost hibernate-osgi testing

I have a fix for HHH-8763, but I'm attempting to boost the unit testing before I release it. I'll keep you updated. Thanks again for the early adoption.

Jostein Gogstad
December 5, 2013, 5:17 PM

That would be great. You know better than me which jars from Aries I need. If you could create a zip and either attach it to this issue or email it to [redacted], I can continue to try to get hibernate-osgi up and running.

Brett Meyer
December 5, 2013, 5:22 PM

Jostein, I have your email down, but removed it above. We get a lot of spam



Brett Meyer


Jostein Gogstad

Fix versions




Suitable for new contributors


Requires Release Note


Pull Request




Affects versions