3

I've installed Apache Karaf v4.03 and queried the list of available features for Hibernate, as listed below. Unfortunately, I am using Hibernate v5.

hibernate                     | 3.3.2.GA         |          | Uninstalled | enterprise-4.0.3         | Hibernate 3.x JPA persistence engine support
hibernate                     | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.2.x JPA persistence engine support
hibernate-envers              | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.2.x
hibernate                     | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.3.x JPA persistence engine support
hibernate-envers              | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.3.x
hibernate-validator           | 5.0.3.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Validator support

I am unable to find instructions for installing Hibernate v5 into Karaf v4. Are there published instructions for performing this task, and perhaps a downloadable features file?

Randy Leonard
  • 655
  • 7
  • 21

3 Answers3

4

Latest hibernate-release comes Karaf ready already:

If you download the hibernate-release-5.0.5.Final.zip from hibernate's page (http://sourceforge.net/projects/hibernate/files/hibernate-orm/5.0.5.Final/hibernate-release-5.0.5.Final.zip/download) and decompress the file, you will see an osgi folder. There you can find an already prepared feauture: hibernate-osgi-5.0.5.Final-karaf.xml. You can just copy it to Karaf's deploy folder and then execute:

feature:install hibernate-orm

It should be installed without any problem.

Another way to install hibernate 5.0.5 feature is to add a repo to features with the command:

feature:repo-add command.

Here you can see the list of hibernate's features and the one I have installed:

karaf@root()> feature:list | grep hibernate
hibernate                     | 3.3.2.GA         |          | Uninstalled | enterprise-4.0.3         | Hibernate 3.x JPA persistence engine support
hibernate                     | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.2.x JPA persistence engine support
hibernate-envers              | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.2.x
hibernate                     | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.3.x JPA persistence engine support
hibernate-envers              | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.3.x
hibernate-validator           | 5.0.3.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Validator support
hibernate-orm                 | 5.0.5.Final      | x        | Started     | hibernate-osgi           | Combines all Hibernate core dependencies and requ
hibernate-envers              | 5.0.5.Final      |          | Uninstalled | hibernate-osgi           | Feature for easily adding Envers support to hiber
hibernate-infinispan          | 5.0.5.Final      |          | Uninstalled | hibernate-osgi           | Feature for easily adding Infinispan-based cachin
hibernate-ehcache             | 5.0.5.Final      |          | Uninstalled | hibernate-osgi           | Feature for easily adding Ehcache-based caching s
karaf@root()>
Jorge Martinez
  • 1,221
  • 8
  • 16
1

Run the following commands on Karaf shell to get Hibernate 5.1.0.Final working on Karaf 4.0.x:

feature:repo-add mvn:org.hibernate/hibernate-osgi/5.1.0.Final/xml/karaf
feature:install hibernate-orm
Lucas Ces
  • 86
  • 5
0

Hibernate 5 already provides a feature that is also available from maven central. Recent karaf versions provide a nice shortcut to install such features:

feature:repo-add hibernate 5.0.5.Final
feature:install hibernate-orm

So there is no need to manually download the hibernate zip. If you build your own feature that needs hibernate 5 then you need to provide a element in it that points to the full hibernate feature url.

mvn:org.hibernate/hibernate-osgi/5.0.5.Final/xml/karaf
Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • None of this works on Karaf 4.0.5 Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=hibernate-orm; type=karaf.feature; version="[5.2.3.Final,5.2.3.Final]"; filter:="(&(osgi.identity=hibernate-orm)(type=karaf.feature)(version>=5.2.3.Final)(version<=5.2.3.Final))" – Shoaib Khan May 22 '18 at 09:51
  • Have you tried to replace the 5.0.5 version with 5.2.3 in the list of commands I provided? – Christian Schneider May 22 '18 at 10:02