[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-04-14 Thread Sergey Beryozkin (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13968280#comment-13968280
 ] 

Sergey Beryozkin commented on ARIES-1160:
-

Sure, everyone seems to be happy about it, so I'm about to apply it shortly

Cheers, Sergey

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: ARIES-1160-2.patch, aries-jpa-1.0.0-ARIES-1160.patch, 
 org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA

[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-04-14 Thread Sergey Beryozkin (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13968302#comment-13968302
 ] 

Sergey Beryozkin commented on ARIES-1160:
-

Looks like Apache SVN can not accept the commits right now...

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: ARIES-1160-2.patch, aries-jpa-1.0.0-ARIES-1160.patch, 
 org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-04-04 Thread Christian Schneider (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13960012#comment-13960012
 ] 

Christian Schneider commented on ARIES-1160:


I wonder if we should not rethrow the exception like in the patch above and 
instead just log it. The problem is that the exception can happen in the 
Activator.start and then aries jpa will not be started because of an error in a 
user bundle.


 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call 

[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-04-04 Thread JIRA

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13960015#comment-13960015
 ] 

Jean-Baptiste Onofré commented on ARIES-1160:
-

I agree, we should at least log the exception to allow users to debug easily.

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-04-04 Thread Andrei Shakirin (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13960018#comment-13960018
 ] 

Andrei Shakirin commented on ARIES-1160:


Hi Christian,
Yes, you are right. Logging should be enough for this case.
Andrei.

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-04-04 Thread Sergey Beryozkin (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13960017#comment-13960017
 ] 

Sergey Beryozkin commented on ARIES-1160:
-

Hi All, I can take care of applying it once the patch is finalized, as it looks 
like all support it
Thanks

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-04-04 Thread Andrei Shakirin (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13960059#comment-13960059
 ] 

Andrei Shakirin commented on ARIES-1160:


For me is still not very clear why createEntityManagerFactories() is called for 
Bundle.RESOLVED event at all. It makes not a lot of sense, because bundle 
context is not yet available and DataSource service cannot be looked up.
From my perspective it should be enough to call createEntityManagerFactories() 
only for Bundle.ACTIVE event.
But as far as patch fixes the problem, we can leave that as it is for now.

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: aries-jpa-1.0.0-ARIES-1160.patch, 
 org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 

[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-03-19 Thread Mdu (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13941224#comment-13941224
 ] 

Mdu commented on ARIES-1160:


How do I checkout the current version (not snapshot) and apply the patch. It'd 
be great if there was already a patched release out there.
Thanks.

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-03-11 Thread JIRA

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13930129#comment-13930129
 ] 

Jean-Baptiste Onofré commented on ARIES-1160:
-

I agree with Andrei's patch.

 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (ARIES-1160) Hibernate JPA: EntityManagerFactoryManager failed to create EntityManagerFactories by Bundle.RESOLVED

2014-03-11 Thread Andrei Shakirin (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIES-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13930131#comment-13930131
 ] 

Andrei Shakirin commented on ARIES-1160:


I am not available until 14.10. For urgent questions please contact Bernd 
Trops: btr...@talend.com.



 Hibernate JPA: EntityManagerFactoryManager failed to create 
 EntityManagerFactories by Bundle.RESOLVED
 -

 Key: ARIES-1160
 URL: https://issues.apache.org/jira/browse/ARIES-1160
 Project: Aries
  Issue Type: Bug
  Components: JPA
Affects Versions: 1.0
 Environment: OSGi
Reporter: Andrei Shakirin
 Attachments: org.apache.aries.jpa.container.patch


 Use case: persistence bundle is deployed in OSGi using Hibernate persistence 
 provider. Bundle contains blueprint configuration injecting EntityManager and 
 activates transaction management:
 blueprint  xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.0.0;
 xmlns:tx=http://aries.apache.org/xmlns/transactions/v1.0.0;
   bean id=addressDao 
 class=de.conrad.ccp.basit.customer.ecom.dao.impl.AddressDaoImpl 
   jpa:context unitname=ecom property=entityManager/
   tx:transaction method=* value=Required/
   /bean
   
   service ref=addressDao 
 interface=de.conrad.ccp.basit.entity.customer.ecom.dao.AddressDao /
   
 /blueprint
 Effect: bundle waiting for EntityManager service. The reason of problem is 
 runtime exception by 
 providerService.createContainerEntityManagerFactory(mpui.getPersistenceUnitInfo(),
  mpui.getContainerProperties()).
 Exception is unfortunately not logged by Aries. The stack trace is following:
 java.lang.IllegalStateException: The bundle 
 de.conrad.poc.customerservice-ecom/0
 .0.1.SNAPSHOT is not started.
 at 
 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDat
 aSource.java:61)
 at 
 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getC
 onnection(DelayedLookupDataSource.java:36)
 at 
 org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get
 Connection(InjectedDataSourceConnectionProvider.java:70)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProvide
 rJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
 at 
 org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcSer
 vicesImpl.java:117)
 at 
 org.hibernate.service.internal.StandardServiceRegistryImpl.configureS
 ervice(StandardServiceRegistryImpl.java:76)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.initialize
 Service(AbstractServiceRegistryImpl.java:160)
 at 
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
 (AbstractServiceRegistryImpl.java:132)
 at 
 org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.
 java:1825)
 at 
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
 a:1783)
 at 
 org.hibernate.ejb.EntityManagerFactoryImpl.init(EntityManagerFactor
 yImpl.java:96)
 at 
 org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
 figuration.java:914)
 at 
 org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManag
 erFactory(OsgiPersistenceProvider.java:99)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.creat
 eEntityManagerFactories(EntityManagerFactoryManager.java:330)
 at 
 org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundl
 eStateChange(EntityManagerFactoryManager.java:175)
 at 
 org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingSe
 rvice(PersistenceBundleManager.java:197)
 The problem is that call of createEntityManagerFactories() in 
 EntityManagerFactoryManager.bundleStateChange() is made by BUNDLE.RESOLVED 
 event.
 The lookup of data source is failed, because the bundle context is not yet 
 available (call by BUNDLE.RESOLVED event). The createEntityManagerFactory is 
 called again by Bundle.ACTIVE event, the problem is that emfs hash map is 
 already created, but it is empty.
 Therefore  STARTED/ACTIVE createEntityManagerFactories() is called, but makes 
 nothing.
 Attached patch contains two changes:
 a) log runtime exception throwing by 
 providerService.createContainerEntityManagerFactory
 b) adds check to empty hash map:
 if(((emfs == null) || emfs.isEmpty())  !quiesce)
 The patch fixes the problem.
 Basically it should analyzed is call createEntityManagerFactories() really 
 necessary for Bundle.RESOLVED event. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)