- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在我的 Wildfly swarm 应用程序中,我想将 deltaspike 与数据模块、JPA 和 JTA 一起使用。
我已将 beans.xml 定义为使用 EnvironmentAwareTransactionStrategy 作为 TransactionStrategy。
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
<alternatives>
<class>org.apache.deltaspike.jpa.impl.transaction.EnvironmentAwareTransactionStrategy</class>
</alternatives>
但是,当我运行我的应用程序时,会引发此异常:
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:1333)
at org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.getTransaction(ResourceLocalTransactionStrategy.java:372)
at org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.rollbackAllTransactions(ResourceLocalTransactionStrategy.java:338)
at org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:155)
at org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor.executeInTransaction(TransactionalInterceptor.java:57)
CDI 使用默认的 TransactionStrategy (ResourceLocalTransactionStrategy),而不是我的 beans.xml 中定义的替代策略 (EnvironmentAwareTransactionStrategy)。
文件 beans.xml 位于 src/main/resources/META-INF 中,并且在我的 pom.xml 中
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>datasources</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jpa</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>cdi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-data-module-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-data-module-impl</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-impl</artifactId>
<scope>runtime</scope>
</dependency>
我该怎么做?
最佳答案
Deltaspike 给出了更多使用说明:
https://deltaspike.apache.org/documentation/jpa.html
In case of some versions of Weld - including several versions of JBoss EAP/Wildfly and Websphere Liberty Profile - or OpenWebBeans in BDA mode - which is not the default one, you have to configure it as a global alternative instead of an alternative in beans.xml
和
https://deltaspike.apache.org/documentation/spi.html#GlobalAlternative
他们建议使用 apache-deltaspike.properties 作为解决方法。
关于java - Deltaspike 替代 TransactionStrategy 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48571081/
如何禁用使用 @ViewScoped 时出现的加载屏幕与 DeltaSpike? 最佳答案 好的,看起来这是有效的: @Specializes public class UkaClientWindow
我正在尝试使用 DeltaSpike 测试控制模块为我正在开发的新 Maven 应用程序创建集成测试 它正在部署在 Wildfly 9 实例上 一个简单的测试用例: @RunWith(CdiTestR
我尝试打印存储库中包含的查询的行数。这是存储库: @Repository public interface TagRepository extends EntityRepository { /
我正在使用 Global Alternatives 配置在 apache-deltaspike.properties 中定义 TransactionStrategy: globalAlternativ
我已经实现了从属性文件配置 CronExpression,但该属性文件是 apache-deltaspike.properties,它位于 .jar 文件内。我需要从自定义配置文件中获取 cron 表
在我的 Wildfly swarm 应用程序中,我想将 deltaspike 与数据模块、JPA 和 JTA 一起使用。 我已将 beans.xml 定义为使用 EnvironmentAwareTra
我想用 DeltaSpike-API 保护我的“无状态”EJb。 @Stateless @Remote(UserServiceRemote.class) public class UserServic
我非常喜欢将 Deltaspikes 数据模块与其存储库一起使用。为了提高生产力并减少错误,我还通过 JUnit 编写单元测试。在我在测试用例中使用 DBUnit 和 Plain JPA/Hibern
在 Wildfly 11 中部署 test.war 期间,我看到了一些警告: 09:45:32,714 WARN [org.jboss.weld.Validator] (MSC service th
我正在关注 DeltaSpike documentation创建绑定(bind)配置属性的可注入(inject)接口(interface)。 @Configuration(prefix = "appl
根据its doc Deltaspike Data 使用 ASM: As of DeltaSpike v1.4.0, the Data module internally leverages the
我编写了一个简单的 Web 应用程序来使用 Apache Deltaspike 0.5,但遇到了问题。该应用程序是一个简单的 JavaEE 6 应用程序,作为 JBoss EAP 6.1 上的 EAR
我正在尝试定义自定义 DeltaSpike ConfigSource。自定义配置源将具有最高优先级,并检查数据库中的配置参数。 我有一个 ConfigParameter 实体,它只有一个键和一个值。
我正在使用部署在 JBoss 7.1.1 上的 DeltaSpike 1.7.1 和 CDI 1.0 (Weld 1.1.5)。这是一个遗留项目,我无法更改我们正在使用的技术。 只有当我部署多个 WA
我正在尝试对 DeltaSpike 存储库运行一个简单的测试。但是,我无法注入(inject)实体管理器。我正在使用位于和测试源的生产者: @ApplicationScoped public clas
我正在尝试使用 DeltaSpike Data模块 Weld ,但每个类都用 @Repository 注释在我的 IDE 中显示警告,并在运行时显示异常。 我尝试遵循DeltaSpike docume
我猜这个标题是不言自明的。我有一份工作: import org.apache.deltaspike.scheduler.api.Scheduled; import org.quartz.Job; @S
我正在 WildFly 8 (Java EE 7) 上从 Seam 3 迁移到 DeltaSpike。与 Seam 的 seam-beans.xml 等效的 DeltaSpike 文件是什么?你能告诉
我是 Spring 的长期用户,现在不得不只切换到 Java EE。有很多事情并没有像预期的那样工作...... 我有一个 CXF/SOAP 服务 @WebService( ... ) @SOAPBi
我正在尝试使用 DeltaSpike 1.0 @Exclude-Annotation 排除 Bean 实现。排除应该基于这样的属性值: @Exclude(onExpression = "provide
我是一名优秀的程序员,十分优秀!