0 Replies Latest reply on Apr 9, 2014 4:19 AM by jaakkorautiainen

    JBoss 7.2.0.Final + OSGi + Hibernate JBoss modules

    jaakkorautiainen

      Greetings!

       

      I have a question about the way JBoss OSGi subsystem handles dependencies on JBoss system modules.

       

      If the bundle has a class with a @PersistenceProvider -annotation in it and a META-INF/persistence.xml -file, JBoss is supposed to automatically add a dependency to the system Hibernate 4 module.

       

      Since my application uses Hibernate 3.6.1, I made a Hibernate 3 module as per the instructions in the JBoss 7.2.0 developer guide and then added "Dependencies: org.hibernate:3" to the MANIFEST.MF of the OSGi bundle containing the persistence.xml. Then I added a META-INF/jboss-deployment-structure.xml to exclude loading the implicit Hibernate 4 module.

       

      Now, the corresponding Spring bundles on the other hand, also need the Hibernate module classes loaded in their class loader. The import-package part of the MANIFEST.MF specifies the org.hibernate.x dependencies as optional. I cracked open the Spring ORM bundle, added in the MANIFEST.MF "Dependencies: org.hibernate:3" to declare an explicit JBoss module dependency on the Hibernate 3 module.

       

      The problem is, this doesn't appear to do anything. Looking at the standalone log, there is no wiring whatsoever happening between the Hibernate 3 module and the Spring bundle.

       

      I would like to avoid explicitly listing all the Hibernate 3 module packages and their versions in the standalone-config.xml, if possible, and handle this dependency on a module level to keep the configuration from exploding.

       

      My questions are:

      1) Is there a way in JBoss 7.2.0.Final OSGi subsystem to specify a module-level dependency from an OSGi bundle to a JBoss module?

      2) Does the JBoss implicit module dependency mechanism operate for OSGi bundles?

       

      Thank you for any help.

       

      Best Regards,

      Jaakko Rautiainen