【问题标题】:I can not use aries jpa/v2.0.0 and transactions/v2.0.0我不能使用 aries jpa/v2.0.0 和 transactions/v2.0.0
【发布时间】:2016-06-19 02:03:54
【问题描述】:

我尝试了 enable 和 int blueprint.xml 但我有错误。这是我的xml文件

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0"
           xmlns:tx="http://aries.apache.org/xmlns/transactions/v2.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
           http://aries.apache.org/xmlns/jpa/v2.0.0
           http://aries.apache.org/xmlns/transactions/v2.0.0 ">
    <jpa:enable/>
    <tx:enable-annotations/>
    <service ref="userService" interface="domain.access.UserService"/>
    <bean id="userService" class="domain.access.impl.UserServiceImpl" scope="singleton">
    </bean>
</blueprint>

这是我在 pom.xml 中的依赖项,我包含了所有的库,可能我忘记了

<dependencies>
           <dependency>
               <groupId>sqljdbc41</groupId>
               <artifactId>sqljdbc41</artifactId>
               <version>4.1</version>
           </dependency>
           <dependency>
               <groupId>org.apache.servicemix.bundles</groupId>
               <artifactId>org.apache.servicemix.bundles.commons-dbcp</artifactId>
               <version>1.4_3</version>
           </dependency>
           <dependency>
               <groupId>org.apache.geronimo.specs</groupId>
               <artifactId>geronimo-jpa_2.0_spec</artifactId>
               <version>1.1</version>
           </dependency>
           <dependency>
               <groupId>org.apache.geronimo.specs</groupId>
               <artifactId>geronimo-validation_1.0_spec</artifactId>
               <version>1.1</version>
           </dependency>
           <dependency>
               <groupId>org.apache.geronimo.specs</groupId>
               <artifactId>geronimo-jta_1.1_spec</artifactId>
               <version>1.1.1</version>
           </dependency>
           <dependency>
               <groupId>org.apache.openjpa</groupId>
               <artifactId>openjpa</artifactId>
               <version>2.4.1</version>
           </dependency>
           <dependency>
               <groupId>kg.nurtelecom</groupId>
               <artifactId>access-module-api</artifactId>
               <version>1.0.0</version>
           </dependency>
           <dependency>
               <groupId>domain</groupId>
               <artifactId>platform-common</artifactId>
               <version>1.0.0</version>
           </dependency>
           <dependency>
               <groupId>javax.transaction</groupId>
               <artifactId>javax.transaction-api</artifactId>
               <version>1.2</version>
           </dependency>
       </dependencies>

当我开始捆绑时,我有宽限期并在日志中

2016-03-05 12:34:37,732 | INFO  | l for user karaf | BlueprintContainerImpl           | 15 - org.apache.aries.blueprint.core - 1.4.4 | Bundle kg.nurtelecom.access.module.impl/1.0.0 is waiting for name
space handlers [http://aries.apache.org/xmlns/jpa/v2.0.0, http://aries.apache.org/xmlns/transactions/v2.0.0]

【问题讨论】:

    标签: java xml jpa osgi


    【解决方案1】:

    在事务 2.0.0 命名空间中,xml 元素被命名为 &lt;tx:enable/&gt; 而不是 &lt;tx:enable-annotations/&gt;。不过,这与您描述的错误无关。

    错误表明您没有安装正确的 Aries JPA 包。请务必安装所有必要的功能,例如 this example

    pom 中的依赖项仅涵盖构建时间。在运行时,您必须将依赖项作为 karaf 功能或单独的包提供。

    还要确保您使用最新的 Apache Karaf。旧版本不包含 aries transaction 2.0.0 捆绑包。

    【讨论】:

    • 我有 3.0.6 karaf。是否包含 aries 事务 2.0.0 捆绑包?我将 更改为 ,但 IDE 中突出显示的内容
    • 你需要 karaf 4。
    • 我不能在 karaf 3.0.6 中使用这个功能?而且我没有找到需要更改 Aries JPA 捆绑包的地方,你能写下我需要更改的行吗?我有几个地方注册了功能。现在我改变这个: jpa
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-31
    • 2015-11-26
    • 1970-01-01
    • 1970-01-01
    • 2021-11-29
    相关资源
    最近更新 更多