java - 我无法使用 aries jpa/v2.0.0 和 transactions/v2.0.0

标签 java xml jpa osgi

我尝试启用并 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]

最佳答案

在事务 2.0.0 命名空间中,xml 元素名为 <tx:enable/>不是<tx:enable-annotations/> 。但这与您描述的错误无关。

该错误表明您没有安装正确的 Aries JPA bundle 。确保安装所有必需的功能,如this example .

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

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

关于java - 我无法使用 aries jpa/v2.0.0 和 transactions/v2.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35811260/

相关文章:

mysql - 返回的日期值与数据库中存储的日期值不同

java - JPA MappedSuperClass继承策略

java - Eclipse block 着色

java - Servlet java.lang.NumberFormatException

java - 为什么Maven要从远程仓库下载模块

xml - 在 Hadoop 中创建许多小的 XML 文件

java - 在 Spring Boot 2 中,我如何接受 LocalDates 作为 RequestParams

java - 如何在作为 xml 布局文件一部分的框架布局中创建 Canvas

javascript - "Object doesn' t 支持属性或方法”当我尝试调用插件时

performance - 使用 JPA 获取存储在 TIMESTAMP 中的日期(按月或年)