Aries JPA - Application fails to start - Waiting for PersistenceFactory - No PersistenceContextProvider

924 Views Asked by At

We are using Fuse 6.1. We are trying to use Aries JPA with hibernate with blueprint. I am unable to get Entity Manager. Here are my configuration

Persistence.xml

    <?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <properties>
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
            <property name="hibernate.archive.autodetection" value="class, hbm"/>
            <property name="hibernate.connection.password">password</property>
            <property name="hibernate.connection.url">jdbc:oracle:thin:@host:port:SID</property>
            <property name="hibernate.connection.username">user</property>
        </properties>
    </persistence-unit>
</persistence>

Blueprint.xml

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/blueprint"
    xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
    xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
    xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
       http://aries.apache.org/xmlns/jpa/v1.0.0 http://aries.apache.org/schemas/jpa/jpa.xsd
       http://aries.apache.org/xmlns/transactions/v1.0.0 http://aries.apache.org/schemas/transaction/transactionv10.xsd">


    <bean id="referenceDao"
        class="com.common.reference.dao.impl.ReferenceDAOImpl">
        <jpa:context unitname="default" property="entityManager" />
    </bean>
</blueprint>

Feature.xml

<?xml version="1.0" encoding="UTF-8"?>
<features name="common-1.0.0">
    <feature name="common" version="1.0.0">
         <feature>transaction</feature>
        <feature>jpa</feature>
        <feature version="3.2.9.RELEASE_1">spring-orm</feature>
        <bundle start-level="30" dependency="true">mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.0</bundle>
        <bundle start-level="30" dependency="true">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.1</bundle>
        <bundle start-level="30" dependency="true">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.1</bundle>
        <bundle start-level="30" dependency="true">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.1</bundle>
        <bundle start-level="30" dependency="true">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/1.14.1_1</bundle>
        <bundle dependency="true">mvn:com.fasterxml/classmate/0.9.0</bundle>
        <bundle dependency="true">mvn:org.javassist/javassist/3.18.1-GA</bundle>
        <bundle dependency="true">mvn:org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.4_spec/1.0.2.Final</bundle>
        <bundle dependency="true">wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
        <bundle dependency="true">mvn:org.jboss.logging/jboss-logging/3.1.4.GA</bundle>
        <bundle dependency="true">mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
        <bundle start-level="100" >mvn:org.hibernate/hibernate-core/4.3.6.Final</bundle>
        <bundle start-level="100">mvn:org.hibernate/hibernate-entitymanager/4.3.6.Final</bundle>
        <bundle start-level="100">mvn:myapplication/common/1.0.0</bundle>
        <bundle start-level="100">mvn:org.hibernate/hibernate-osgi/4.3.6.Final</bundle>

    </feature>
</features>

Below are features/bundles applied in profile which is applied to fuse container

fabric-agent 
 fabric-maven-proxy 
 myapp-support/1.0.0 
 spring-tx/3.2.9.RELEASE_1 
 jpa/1.0.1.redhat-610379 
 jndi/1.0.0 
 myapp/1.0.0 
 transaction/1.0.1.redhat-610379 
 spring/3.2.9.RELEASE_1 
 spring-orm/3.2.9.RELEASE_1 
 ojdbc14/10.2.0.3.0 
 fabric-agent-commands 
 spring-jdbc/3.2.9.RELEASE_1 
 common/1.0.0 

Error Message:

The bundle common/1.0.0 is a client of persistence unit default with properties {org.apache.aries.jpa.context.type=TRANSACTION}, but no PersistenceContextProvider is available in the runtime. The blueprint for this bundle will not start correctly unless the managed persistence context is registered through some other mechanism.   

 Bundle common is waiting for dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=default))(objectClass=javax.persistence.EntityManagerFactory))]
2015-02-19 18:04:44,955 | ERROR | rint Extender: 2 | BlueprintContainerImpl           | ntainer.BlueprintContainerImpl$1  336 | 9 - org.apache.aries.blueprint.core - 1.0.1.redhat-610379 | Unable to start blueprint container for bundle common due to unresolved dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=default))(objectClass=javax.persistence.EntityManagerFactory))]
java.util.concurrent.TimeoutException
        at org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:332)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379]
        at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_75]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_75]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_75]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_75]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_75]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_75]
        at java.lang.Thread.run(Thread.java:745)[:1.7.0_75]

0

There are 0 best solutions below