[jboss-dev-forums] [JBoss AS 7 Development] - TransactionRequiredException: JBAS011469: Transaction is required to perform this operation

Hiep Le Canh do-not-reply at jboss.com
Thu May 31 03:55:02 EDT 2012


Hiep Le Canh [https://community.jboss.org/people/canhhiep] created the discussion

"TransactionRequiredException: JBAS011469: Transaction is required to perform this operation"

To view the discussion, visit: https://community.jboss.org/message/738946#738946

--------------------------------------------------------------
Hi, 

I have this exception when I am running my app in JBoss 7.1.1 Final:

14:43:23,901 ERROR [stderr] (http--127.0.0.1-8080-2) Caused by: javax.persistence.TransactionRequiredException: JBAS011469: Transaction is required to perform this operation (either use a transaction or extended persistence context)
14:43:23,903 ERROR [stderr] (http--127.0.0.1-8080-2)    at org.jboss.as.jpa.container.AbstractEntityManager.transactionIsRequired(AbstractEntityManager.java:692)
14:43:23,904 ERROR [stderr] (http--127.0.0.1-8080-2)    at org.jboss.as.jpa.container.AbstractEntityManager.merge(AbstractEntityManager.java:547)
14:43:23,907 ERROR [stderr] (http--127.0.0.1-8080-2)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:43:23,908 ERROR [stderr] (http--127.0.0.1-8080-2)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:43:23,909 ERROR [stderr] (http--127.0.0.1-8080-2)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
:25)
14:43:23,910 ERROR [stderr] (http--127.0.0.1-8080-2)    at java.lang.reflect.Method.invoke(Method.java:597)
14:43:23,911 ERROR [stderr] (http--127.0.0.1-8080-2)    at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferen
ceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
14:43:23,914 ERROR [stderr] (http--127.0.0.1-8080-2)    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
14:43:23,916 ERROR [stderr] (http--127.0.0.1-8080-2)    at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.jav
a:374)

I think this piece of code make exception is:

public int getSomething() throws Exception {
           try {
                // this code make exception
            } catch (NoSuchUserException x) {
                //do nothing here
            }
}

The excepion is already catch, and does not throw to the caller, but it seems that the transaction is marked as rollback, so transaction cannot be commited. 
The above code has worked fine in both JBoss 5 and 7.0.2, but in JBoss 7.1.1 Final the TransactionRequiredException is thrown and transaction fails. Could you please let me know how to config to make the transaction still exist in case exception happen but was catched ?.

Thanks
Hiep
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/738946#738946]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120531/410cc488/attachment.html 


More information about the jboss-dev-forums mailing list