Announcement Announcement Module

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Hibernate and OSGi integration Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate and OSGi integration

    I know that there are many post related to this theme, but I couldn't find any simple example
    I'm creating spring dynamic bundle which should communicate with database and I decided to use Hibernate as I used it in non OSGI application.
    Maybe somebody knows good example how to do that?

    At the moment I'm getting error org.hibernate.cfg.Configuration class not found. When I use it in import package the bundle even not compile in eclipse.

    Thank you in advance

    J. Lu

  • #2
    If you have placed your hibernate.jar (+ its dependent jars) within your DM bundle's lib directory, it needs to be part of the DM bundle project's 'build path', and 'runtime class path' You cannot import hibernate pkgs through the DM bundle's MANIFEST.MF if your hibernate jars are not OSGi bundles.

    To use hibernate in a fully OSGi-ified environment, you would need to repackage hibernate and all its dependencies as OSGi bundles themselves, and make sure they import / export all the right pkgs within their own manifests. This is a non-trivial task: for example, a circular dependency between hibernate and antlr will trip you up. If you use JPA, load-time-weaving issues will take time to sort out.

    If I were just starting out with OSGi and Spring DM, I would not try to OSGi-ify hibernate yet. Put the original hibernate jars in the DM project's lib dir, and make sure those jars are on the project's build path and runtime classpath.

    Good luck.