deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Li <michael...@gmail.com>
Subject Re: A JTA EntityManager cannot use getTransaction()
Date Thu, 01 May 2014 09:15:10 GMT
I did debug through the invocation flow. It invoked
ResourceLocalTransactionStrategy's "getTransaction" method, not the
overridden in BeanManagedUserTransactionStrategy. I haven't figured out why
"Alternatives" in beans.xml didn't take effect. The current code structure
is an ear based gradle multi-project. I'll try it in a simple project
tomorrow. Thanks for the reply.

Michael.


On Thu, May 1, 2014 at 12:34 AM, Mark Struberg <struberg@yahoo.de> wrote:

> Hi Michael!
>
> BeanManagedUserTransactionStrategy extends
> ResourceLocalTransactionStrategy.
>
> I suggest you create a breakpoint and debug through what this.class() you
> get.
>
> LieGrue,
> strub
>
>
> On Thursday, 1 May 2014, 0:53, Michael Li <michael.go@gmail.com> wrote:
>
> I have configured my beans.xml to use BeanManagedUserTransactionStrategy
> >(beans.xml content shown below). However, the
> >"ResourceLocalTransactionStrategy" is still used from error message. Any
> >clue? By the way, I am using JBoss 7.2 and Jta data source.
> >
> >*** beans.xml ***
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><beans xmlns="http://java.sun.com/xml/ns/javaee"
> >       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> >http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
> >    <interceptors>
> >
>
> ><class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>
> >    </interceptors>
> >    <alternatives>
>
> ><class>org.apache.deltaspike.jpa.impl.transaction.BeanManagedUserTransactionStrategy</class>
> >    </alternatives>
> ></beans>
> >
> >*** Exception ***
> >
> >Caused by: java.lang.IllegalStateException: A JTA EntityManager cannot use
> >getTransaction()
> >at
>
> >org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:1019)
> >[hibernate-entitymanager-4.2.0.Final.jar:4.2.0.Final]
> >at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >[rt.jar:1.7.0_51]
> >at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >[rt.jar:1.7.0_51]
> >at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> >[rt.jar:1.7.0_51]
> >at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_51]
> >at
>
> >org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45)
> >[weld-core-1.1.10.Final.jar:2012-10-12 10:00]
> >at
>
> >org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
> >[weld-core-1.1.10.Final.jar:2012-10-12 10:00]
> >at
>
> >org.jboss.weld.proxies.EntityManager$-676163098$Proxy$_$$_WeldClientProxy.getTransaction(EntityManager$-676163098$Proxy$_$$_WeldClientProxy.java)
> >at
>
> >org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.getTransaction(ResourceLocalTransactionStrategy.java:308)
> >[deltaspike-jpa-module-impl-0.6.jar:0.6]
> >at
>
> >org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.rollbackAllTransactions(ResourceLocalTransactionStrategy.java:274)
> >[deltaspike-jpa-module-impl-0.6.jar:0.6]
> >at
>
> >org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:153)
> >[deltaspike-jpa-module-impl-0.6.jar:0.6]
> >at
>
> >org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor.executeInTransaction(TransactionalInterceptor.java:57)
> >[deltaspike-jpa-module-impl-0.6.jar:0.6]
> >
> >
> >--
> >Michael Li
> >
> >
> >
>



-- 
Michael Li

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message