Hi,
I use Tomcat 6 with Seam 2.0.1GA with non managed JPA and @Asynchronous
I've got problem, if transaction fails and I catch exception and serve it, all next executions are blocked and my Asynchronous method stops.
This happen only if I start transaction. If I throw exception without tx, exception is served and next executions are executed.
Here is my code:
//====Scheduler
@Asynchronous
public QuartzTriggerHandle scheduleMoves(@Expiration Date when,
@IntervalDuration Long interval,
@FinalExpiration Date stopTime,
Person obj) {
synchronized (MovesProcessor.class) {
int em = 0;
try {
for (em = 1; em <= max_worlds; em++) {
try {
getEM(em).getTransaction().begin();
int a = 2;
int b = 0;
//throw exception
int c = a/b;
getEM(em).getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
if (getEM(em).getTransaction().isActive())
getEM(em).getTransaction().setRollbackOnly();
} finally { closeEM(); }
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}Can anybody help me how to fix this, and start next executions.