1

我们正在使用 Fuse 6.1。我们正在尝试将 Aries JPA 与带有蓝图的休眠一起使用。我无法获得实体管理器。这是我的配置

持久性.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>

蓝图.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>

特征.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 

错误信息:

捆绑包 common/1.0.0 是具有属性 {org.apache.aries.jpa.context.type=TRANSACTION} 的持久性单元默认客户端,但运行时中没有可用的 PersistenceContextProvider。除非通过某种其他机制注册托管持久性上下文,否则此捆绑包的蓝图将无法正确启动。   

Bundle common 正在等待依赖项 [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=default))(objectClass=javax.persistence.EntityManagerFactory))]
2015-02-19 18:04:44,955 | 错误 | rint 扩展器:2 | BlueprintContainerImpl | ntainer.BlueprintContainerImpl $1 336 | 9 - org.apache.aries.blueprint.core - 1.0.1.redhat-610379 | 由于未解决的依赖关系,无法启动 bundle common 的蓝图容器 [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=default))(objectClass=javax.persistence.EntityManagerFactory ))]
java.util.concurrent.TimeoutException
        在 org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:332)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379]
        在 org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379]
        在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_75]
        在 java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_75]
        在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_75]
        在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_75]
        在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_75]
        在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_75]
        在 java.lang.Thread.run(Thread.java:745)[:1.7.0_75]

4

0 回答 0