Showing posts with label seam. Show all posts
Showing posts with label seam. Show all posts

Monday, 14 August 2017

Caused by javax.persistence.TransactionRequiredException with message: “no transaction is in progress” ~ foundjava

This is weird, I am not sure why I am getting it. I have an application that makes some calculations that take some considerable time, and I persist the results. I run my application with 100 records from the database and everything works fine. I run my application with 60.000 records from the database and I am getting the above error message. The exception happens when the flush() method is called on the EntityManager. If I am to have a wild guess I’d say that there is a transaction time out (it is set to 30 seconds in the weblogic console) and therefore when the flush() method is called there is no active transaction.
Anyway I managed to overcome this issue by explicitly defining a user transaction
1
2
3
4
5
6
7
8
9
10
import org.jboss.seam.transaction.Transaction;
import org.jboss.seam.transaction.UserTransaction;
...
...
 
UserTransaction ut = Transaction.instance();
ut.begin();
...
...
ut.commit();
If you have any idea why this is happening please leave a comment.
UPDATE: Now the first transaction (the one with 100 records) fails. It complains that there is already one transaction active when I try to start a new one. I guess I need to revert my code and to increase the transaction timeout on the weblogic console, this would solve both issues.
Read More »

Unknown runtime error Line: 120 Char: 1 Code: 0 URI: 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript ~ foundjava

Not strictly Java related but I thought I could post it here. I was getting the error
Unknown runtime error Line: 120 Char: 1 Code: 0 URI: 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript
on I.E. (FF and Chrome worked fine) when I included a form within a form in RichFaces. As soon as I got rid of the second form (in the included file) the problem went away.
Read More »