You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Tony L (JIRA)" <ji...@apache.org> on 2012/12/04 15:44:58 UTC

[jira] [Commented] (ARIES-978) Aries JPA does not work with Hibernate

    [ https://issues.apache.org/jira/browse/ARIES-978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509771#comment-13509771 ] 

Tony L commented on ARIES-978:
------------------------------

Actually, I was thinking is Aries JPA even supposed to work with Hibernate?

After looking over the source code, I only see its tested concretely test with OpenJPA. As long as there are no Hibernate tests, we should not be using Aries with Hibernate because it can break with any check-in. Maybe this should be a request for feature instead.

Aries should probably also state clearly that it only works with OpenJPA, to avoid confusion and more issues.
                
> Aries JPA does not work with Hibernate
> --------------------------------------
>
>                 Key: ARIES-978
>                 URL: https://issues.apache.org/jira/browse/ARIES-978
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>         Environment: Glassfish 3.1.1, Hibernate 3.5.2-Final, Aries JPA 1.0.0 Release
>            Reporter: Tony L
>            Priority: Blocker
>              Labels: Hibernate, JPA
>
> 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira