title: JPA / Hibernate integration in Apache Felix
body: <p>Hi I run an apache Felix instance embedded in tomcat. I need JPA (Hibernate 4.2.7 implementation) integration, but I get this exception on creation of the EntityManagerFactory.
  For the record if i switch to OpenJPA everything works fine, but this solution is not admissible</p>
  
  <p>I have two bundles:</p>
  
  <p>dbconnection-ds: blueprint.xml</p>
  
  <pre><code>&lt;blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
             xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" 
             xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0"
             xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"&gt;
  
  
      &lt;!-- BASIC CONFIGURATION --&gt;
      &lt;bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"&gt;
        &lt;property name="url" value="jdbc:mysql://127.0.0.1:3306/test"/&gt;
            &lt;property name="user" value="root"/&gt;
            &lt;property name="password" value=""/&gt;
       &lt;/bean&gt;
  
       &lt;service interface="javax.sql.XADataSource" ref="dataSource"&gt;
          &lt;service-properties&gt;
                  &lt;entry key="osgi.jndi.service.name" value="jdbc/test"/&gt;
          &lt;/service-properties&gt;
       &lt;/service&gt;
  
  &lt;/blueprint&gt;
  </code></pre>
  
  <p>dbconnection: blueprint.xml</p>
  
  <pre><code>&lt;blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
         xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" 
         xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0"
         xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"&gt;
  
  
  &lt;bean id="dbService" class="examples.DBService"&gt;
    &lt;jpa:context property="em" unitname="testPU" /&gt;
    &lt;tx:transaction method="*" value="Required"/&gt;
      &lt;/bean&gt; 
  
   &lt;service ref="dbService" interface="examples.IDBService" &gt;
     &lt;service-properties&gt;
          &lt;entry key  ="osgi.jndi.service.name"
                 value="hibernate/dbService"/&gt;
      &lt;/service-properties&gt;
   &lt;/service&gt;
  
  &lt;/blueprint&gt;
  </code></pre>
  
  <p>dbconnection: perisitence.xml</p>
  
  <pre><code>&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      version="2.0"&gt;
  
      &lt;persistence-unit name="testPU" transaction-type="JTA"&gt;
              &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
              &lt;jta-data-source&gt;osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name=jdbc/test)&lt;/jta-data-source&gt;
           &lt;properties&gt;
              &lt;property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /&gt;
              &lt;property name="hibernate.connection.url" value="jdbc:mysql://127.0.0.1:3306/test" /&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Here it is my stacktrace</p>
  
  <pre><code> INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.felix.framework.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jndi.url.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.hibernate.osgi.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: classmate.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.felix.fileinstall.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jpa.blueprint.aries.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.servicemix.bundles.serp.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.proxy.impl.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.geronimo.specs.geronimo-jta_1.1_spec.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: null.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: com.fasterxml.jackson.core.jackson-databind.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.blueprint.api.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.karaf.jndi.core.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.felix.shell.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.servicemix.bundles.antlr.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jpa.container.context.
   INFO  | main             | o.a.a.j.c.context                |  -  -  | No quiesce support is available, so managed persistence units will not participate in quiesce operations.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.hibernate.common.hibernate-commons-annotations.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.felix.shell.remote.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.util.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.jboss.spec.javax.security.jacc.jboss-jacc-api_1.4_spec.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.blueprint.core.
   INFO  | main             | o.a.a.b.c.BlueprintExtender      |  -  -  | No quiesce support is available, so blueprint components will not participate in quiesce operations
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: com.fasterxml.jackson.core.jackson-core.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.geronimo.specs.geronimo-jpa_2.0_spec.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: javassist.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: com.springsource.org.apache.catalina.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jndi.api.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.felix.configadmin.
   DEBUG | rint Extender: 1 | o.a.a.j.b.aries                  |  -  -  | Managed persistence context support is now available for use with the Aries Blueprint container
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jndi.legacy.support.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jndi.rmi.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.felix.log.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.jboss.logging.jboss-logging.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.blueprint.cm.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.proxy.api.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.proxy.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.transaction.blueprint.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.servicemix.bundles.dom4j.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.xbean.naming.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.servicemix.bundles.ant.
   INFO  | rint Extender: 1 | o.a.a.b.c.BlueprintContainerImpl |  -  -  | Bundle org.apache.aries.transaction.blueprint is waiting for dependencies [(objectClass=javax.transaction.TransactionManager)]
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jpa.api.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: com.fasterxml.jackson.core.jackson-annotations.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.transaction.manager.
   INFO  | main             | o.a.a.j.c.context                |  -  -  | A TransactionSynchronizationRegistry service is now available in the runtime. Managed persistence contexts will now integrate with JTA transactions using [org.apache.aries.transaction.AriesTransactionManager, javax.transaction.TransactionManager, javax.transaction.TransactionSynchronizationRegistry, javax.transaction.UserTransaction, org.apache.geronimo.transaction.manager.RecoverableTransactionManager].
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.hibernate.core.
   WARN  | es.transaction]) | o.a.a.j.c.context                |  -  -  | The TransactionSynchronizationRegistry used to manage persistence contexts is no longer available. Managed persistence contexts will no longer be able to integrate with JTA transactions, and will behave as if  no there is no transaction context at all times until a new TransactionSynchronizationRegistry is available. Applications using managed persistence contexts may not work correctly until a new JTA Transaction services implementation is available.
   INFO  | es.transaction]) | o.a.a.j.c.context                |  -  -  | A TransactionSynchronizationRegistry service is now available in the runtime. Managed persistence contexts will now integrate with JTA transactions using [org.apache.aries.transaction.AriesTransactionManager, javax.transaction.TransactionManager, javax.transaction.TransactionSynchronizationRegistry, javax.transaction.UserTransaction, org.apache.geronimo.transaction.manager.RecoverableTransactionManager].
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jndi.core.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.hibernate.entitymanager.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | Starting bundle: org.apache.aries.jpa.container.
   INFO  | main             | o.a.a.j.container                |  -  -  | The file org.apache.aries.jpa.container.properties was not found in bundle org.apache.aries.jpa.container/1.0.1.SNAPSHOT. The default properties {} will be used.
   DEBUG | main             | o.a.a.j.container                |  -  -  | Adding a provider: [javax.persistence.spi.PersistenceProvider]
   INFO  | main             | o.a.a.j.container                |  -  -  | No quiesce support is available, so managed persistence units will not participate in quiesce operations.
   INFO  | main             | e.u.n.c.s.d.ProvisionActivator   |  -  -  | System bundles installed.
   INFO  | Thread-4         | o.a.f.fileinstall                |  -  -  | Installing bundle db-connection / 1.0.0.SNAPSHOT
   DEBUG | a\ucg\components | o.a.a.j.container                |  -  -  | Located Persistence descriptors: [META-INF/persistence.xml] db-connection_1.0.0. 
   DEBUG | a\ucg\components | o.a.a.j.container                |  -  -  | Located Persistence units: [Persistence unit testPU in bundle db-connection_1.0.0. 
   INFO  | Thread-4         | e.u.n.c.e.db-connection          |  -  -  | BundleEvent INSTALLED
   org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
   INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
   org.hibernate.Version logVersion
   INFO: HHH000412: Hibernate Core {4.2.7.Final}
   org.hibernate.cfg.Environment &lt;clinit&gt;
   INFO: HHH000206: hibernate.properties not found
   org.hibernate.cfg.Environment buildBytecodeProvider
   INFO: HHH000021: Bytecode provider name : javassist
   org.hibernate.ejb.Ejb3Configuration configure
   INFO: HHH000204: Processing PersistenceUnitInfo [
      name: testPU
      ...]
   org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
   INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
   INFO  | main             | .w.s.h.BeanNameUrlHandlerMapping |  -  -  | Mapped URL path [/errors/*] onto handler '/errors/*'
   INFO  | main             | o.s.b.f.c.PropertiesFactoryBean  |  -  -  | Loading properties file from class path resource [request-dispatcher.properties]
   WARN  | a\ucg\components | o.a.a.j.container                |  -  -  | Error creating EntityManagerFactory
  java.lang.IllegalStateException: The bundle db-connection/1.0.0.SNAPSHOT is not started.
      at org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:62) ~[org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36) ~[org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) ~[na:na]
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242) ~[na:na]
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117) ~[na:na]
      at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76) ~[na:na]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160) ~[na:na]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132) ~[na:na]
      at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1822) ~[na:na]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780) ~[na:na]
      at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:96) ~[na:na]
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) ~[na:na]
      at org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManagerFactory(OsgiPersistenceProvider.java:99) ~[na:na]
      at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.createEntityManagerFactories(EntityManagerFactoryManager.java:331) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:175) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(PersistenceBundleManager.java:300) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:479) [org.apache.felix.framework-4.4.0.jar:na]
      at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:414) [org.apache.felix.framework-4.4.0.jar:na]
      at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [org.apache.felix.framework-4.4.0.jar:na]
      at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:443) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:869) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:790) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:515) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4409) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1126) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:439) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3973) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.Felix.startBundle(Felix.java:2043) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1245) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1217) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:509) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
   INFO  | Thread-4         | e.u.n.c.e.db-connection          | -  -  | BundleEvent RESOLVED
   org.hibernate.ejb.Ejb3Configuration configure
   INFO: HHH000204: Processing PersistenceUnitInfo [
      name: testPU
      ...]
   org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
   INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
   ERROR | a\ucg\components | o.a.a.j.container                | -  -  | The DataSource osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name=jdbc/test) required by bundle db-connection/1.0.0.SNAPSHOT could not be found.
   javax.naming.NoInitialContextException: Unable to find the InitialContextFactory org.apache.naming.java.javaURLContextFactory.
      at org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:150) ~[na:na]
      at org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:49) ~[na:na]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) ~[na:1.7.0_60]
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) ~[na:1.7.0_60]
      at javax.naming.InitialContext.init(InitialContext.java:242) ~[na:1.7.0_60]
      at javax.naming.InitialContext.&lt;init&gt;(InitialContext.java:216) ~[na:1.7.0_60]
      at org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:64) ~[org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) [hibernate-entitymanager-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242) [hibernate-core-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117) [hibernate-core-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76) [hibernate-core-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160) [hibernate-core-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132) [hibernate-core-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1822) [hibernate-core-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780) [hibernate-core-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:96) [hibernate-entitymanager-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) [hibernate-entitymanager-4.2.7.Final.jar:4.2.7.Final]
      at org.hibernate.osgi.OsgiPersistenceProvider.createContainerEntityManagerFactory(OsgiPersistenceProvider.java:99) [hibernate-osgi-4.2.7.Final.jar:4.2.7.Final]
      at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.createEntityManagerFactories(EntityManagerFactoryManager.java:331) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.registerEntityManagerFactories(EntityManagerFactoryManager.java:242) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:185) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(PersistenceBundleManager.java:300) [org.apache.aries.jpa.container-1.0.1-SNAPSHOT.jar:1.0.1-SNAPSHOT]
      at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:479) [org.apache.felix.framework-4.4.0.jar:na]
      at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:414) [org.apache.felix.framework-4.4.0.jar:na]
      at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [org.apache.felix.framework-4.4.0.jar:na]
      at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:443) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:869) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:790) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:515) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4409) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.Felix.activateBundle(Felix.java:2142) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.Felix.startBundle(Felix.java:2070) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976) [org.apache.felix.framework-4.4.0.jar:na]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1245) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1217) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:509) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
      at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310) [org.apache.felix.fileinstall-3.4.0.jar:3.4.0]
  </code></pre>
  
  <p>I installed the following Bundles to let Hibernate works:</p>
  
  <pre><code>&lt;dependency&gt;&lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;&lt;artifactId&gt;geronimo-jta_1.1_spec&lt;/artifactId&gt;&lt;version&gt;1.1.1&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;&lt;artifactId&gt;geronimo-jpa_2.0_spec&lt;/artifactId&gt;&lt;version&gt;1.1&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jpa&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jpa.api&lt;/artifactId&gt;&lt;version&gt;1.0.0&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jpa&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jpa.blueprint.aries&lt;/artifactId&gt;&lt;version&gt;1.0.1&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jpa&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jpa.container&lt;/artifactId&gt;&lt;version&gt;1.0.1&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jpa&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jpa.container.context&lt;/artifactId&gt;&lt;version&gt;1.0.1&lt;/version&gt;&lt;/dependency&gt;
  
  &lt;!--hibernate 4.2.7 --&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.servicemix.bundles&lt;/groupId&gt;&lt;artifactId&gt;org.apache.servicemix.bundles.antlr&lt;/artifactId&gt;&lt;version&gt;2.7.7_5&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.servicemix.bundles&lt;/groupId&gt;&lt;artifactId&gt;org.apache.servicemix.bundles.ant&lt;/artifactId&gt;&lt;version&gt;1.8.2_2&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.servicemix.bundles&lt;/groupId&gt;&lt;artifactId&gt;org.apache.servicemix.bundles.dom4j&lt;/artifactId&gt;&lt;version&gt;1.6.1_5&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.servicemix.bundles&lt;/groupId&gt;&lt;artifactId&gt;org.apache.servicemix.bundles.serp&lt;/artifactId&gt;&lt;version&gt;1.14.1_1&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;com.fasterxml&lt;/groupId&gt;&lt;artifactId&gt;classmate&lt;/artifactId&gt;&lt;version&gt;0.9.0&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.javassist&lt;/groupId&gt;&lt;artifactId&gt;javassist&lt;/artifactId&gt;&lt;version&gt;3.18.1-GA&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.jboss.spec.javax.security.jacc&lt;/groupId&gt;&lt;artifactId&gt;jboss-jacc-api_1.4_spec&lt;/artifactId&gt;&lt;version&gt;1.0.2.Final&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.jboss&lt;/groupId&gt;&lt;artifactId&gt;jandex&lt;/artifactId&gt;&lt;version&gt;1.1.0.Final&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;&lt;artifactId&gt;jboss-logging&lt;/artifactId&gt;&lt;version&gt;3.1.4.GA&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.hibernate.common&lt;/groupId&gt;&lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;&lt;version&gt;4.0.4.Final&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.hibernate&lt;/groupId&gt;&lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;&lt;version&gt;4.2.7.Final&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.hibernate&lt;/groupId&gt;&lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;&lt;version&gt;4.2.7.Final&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.hibernate&lt;/groupId&gt;&lt;artifactId&gt;hibernate-osgi&lt;/artifactId&gt;&lt;version&gt;4.2.7.Final&lt;/version&gt;&lt;/dependency&gt;
  
  &lt;!-- JTA --&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.transaction&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.transaction.blueprint&lt;/artifactId&gt;&lt;version&gt;1.0.1&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.transaction&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.transaction.manager&lt;/artifactId&gt;&lt;version&gt;1.1.0&lt;/version&gt;&lt;/dependency&gt;
  
  &lt;!-- JNDI --&gt;   
  &lt;dependency&gt;&lt;groupId&gt;org.apache.xbean&lt;/groupId&gt;&lt;artifactId&gt;xbean-naming&lt;/artifactId&gt;&lt;version&gt;3.16&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jndi&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jndi.api&lt;/artifactId&gt;&lt;version&gt;1.0.0&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jndi&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jndi.core&lt;/artifactId&gt;&lt;version&gt;1.0.0&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jndi&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jndi.rmi&lt;/artifactId&gt;&lt;version&gt;1.0.0&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jndi&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jndi.url&lt;/artifactId&gt;&lt;version&gt;1.0.0&lt;/version&gt;&lt;/dependency&gt;
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.jndi&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.jndi.legacy.support&lt;/artifactId&gt;&lt;version&gt;1.0.0&lt;/version&gt;&lt;/dependency&gt;                  
  
  &lt;dependency&gt;&lt;groupId&gt;org.apache.aries.proxy&lt;/groupId&gt;&lt;artifactId&gt;org.apache.aries.proxy&lt;/artifactId&gt;&lt;version&gt;1.0.1&lt;/version&gt;&lt;/dependency&gt;
  </code></pre>