Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-978

Aries JPA does not work with Hibernate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Duplicate
    • None
    • None
    • JPA
    • Glassfish 3.1.1, Hibernate 3.5.2-Final, Aries JPA 1.0.0 Release

    Description

      When I attempt to deploy a bundle with persistence.xml and Hibernate is the provider the following exception occurs:

      SEVERE: java.lang.IllegalStateException: The bundle JPATest/0.0.1.SNAPSHOT is not started.
      at org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:61)
      at org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)
      at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:114)
      at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383)
      at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:887)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
      at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.createEntityManagerFactories(EntityManagerFactoryManager.java:329)
      at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:175)
      at org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(PersistenceBundleManager.java:296)
      at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:453)
      at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:237)
      at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:413)
      at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
      at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)
      at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
      at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3758)
      at org.apache.felix.framework.Felix.access$600(Felix.java:80)
      at org.apache.felix.framework.Felix$FelixResolver.fireResolvedEvents(Felix.java:4296)
      at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4062)
      at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3436)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1727)
      at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
      at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:909)

      This does not occur with OpenJPA with the same exact bundle.

      From what I can see is happening EntityManagerFactoryManager is calling createEntityManagerFactories(). This ends up going through Hibernate code from what you can see in the stack trace, and then comes back to Aries code when Hibernate is trying to get the DataSource (which belongs to Aries) and tries calling .getConnection().

      At that point we will go to JndiDataSource getDs() and there Aries code will expect to have a bundleContext, but it is null and the bundle is in the RESOLVED state.

      In OpenJPA this code path never gets hit, and getDs() function is never called.

      There is also this issue:https://issues.apache.org/jira/browse/ARIES-933.
      I'm not sure what has been done since then, but I would appreciate to hear what is the official word on this and if there exist any workarounds.

      This is definitely a blocker if Hibernate is used.

      Related: https://issues.apache.org/jira/browse/ARIES-832

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chejavara Tony L
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: