You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by canhhiep <ca...@yahoo.com> on 2012/05/29 09:26:39 UTC

javax.persistence.TransactionRequiredException: no transaction is in progress

Hi,

I just deploy my ear to tomee+ successfully, but it seems that when
exception is thrown (but exception is already catch and not throw to the
caller) the transaction is killed. 

		try {
			//some thing make exception here;		
		} catch (Exception e) {
			// Ignore 
		}

The exception like this:

javax.persistence.TransactionRequiredException: no transaction is in
progress
        at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:970)
        at
org.apache.openejb.persistence.JtaEntityManager.flush(JtaEntityManager.java:184)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext
.java:181)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
        at sun.reflect.GeneratedMethodAccessor102.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext
.java:181)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)

Could you please let me know how to config to make the transaction still
exist?

Thanks.

--
View this message in context: http://openejb.979440.n4.nabble.com/javax-persistence-TransactionRequiredException-no-transaction-is-in-progress-tp4655161.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: javax.persistence.TransactionRequiredException: no transaction is in progress

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hmm can you share a sample to let us have a look?

Well, note we use openjpa by default and hibernate is not really tested so
maybe that's the issue.

- Romain
Le 30 mai 2012 05:48, "canhhiep" <ca...@yahoo.com> a écrit :

> Hi Romain,
>
> Thanks for your answer, but it has worked fine in JBoss 5, the exception
> also in try {} catch { //do nothing} block, but the transaction still exist
> and commited successfully, I am wordering that tomee+ does not support no
> rollback exception (the exception annotated as
> @ApplicationException(rollback=false)) properly ?
>
> Thanks
> Hiep
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/javax-persistence-TransactionRequiredException-no-transaction-is-in-progress-tp4655161p4655222.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: javax.persistence.TransactionRequiredException: no transaction is in progress

Posted by canhhiep <ca...@yahoo.com>.
Hi Romain, 

Thanks for your answer, but it has worked fine in JBoss 5, the exception
also in try {} catch { //do nothing} block, but the transaction still exist
and commited successfully, I am wordering that tomee+ does not support no
rollback exception (the exception annotated as
@ApplicationException(rollback=false)) properly ?

Thanks
Hiep

--
View this message in context: http://openejb.979440.n4.nabble.com/javax-persistence-TransactionRequiredException-no-transaction-is-in-progress-tp4655161p4655222.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: javax.persistence.TransactionRequiredException: no transaction is in progress

Posted by Romain Manni-Bucau <rm...@gmail.com>.
when the first time it fails (in your try) the transaction is marked
rollback by hibernate then when you try to flush it again hibernate check
the status of the transaction and in particular if it is still active or
not, here it is not active so it fails.

- Romain


2012/5/29 canhhiep <ca...@yahoo.com>

> Hi,
>
> I just deploy my ear to tomee+ successfully, but it seems that when
> exception is thrown (but exception is already catch and not throw to the
> caller) the transaction is killed.
>
>                try {
>                        //some thing make exception here;
>                } catch (Exception e) {
>                        // Ignore
>                }
>
> The exception like this:
>
> javax.persistence.TransactionRequiredException: no transaction is in
> progress
>        at
>
> org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:970)
>        at
>
> org.apache.openejb.persistence.JtaEntityManager.flush(JtaEntityManager.java:184)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext
> .java:181)
>        at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>        at sun.reflect.GeneratedMethodAccessor102.invoke(Unknown Source)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext
> .java:181)
>        at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>
> Could you please let me know how to config to make the transaction still
> exist?
>
> Thanks.
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/javax-persistence-TransactionRequiredException-no-transaction-is-in-progress-tp4655161.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>