Aries JPA - 应用程序无法启动 - 等待PersistenceFactory - 没有PersistenceContextProvider

时间:2015-02-19 10:26:37

标签: hibernate jpa blueprint-osgi aries fusefabric

我们正在使用Fuse 6.1。我们正在尝试将Aries JPA与hibernate一起使用蓝图。我无法获得实体经理。这是我的配置

的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>

以下是应用于保险丝容器的配置文件中应用的功能/包

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 

错误讯息:

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 个答案:

没有答案