users@glassfish.java.net

java.lang.IllegalStateException for Transaction

From: <glassfish_at_javadesktop.org>
Date: Mon, 30 Jun 2008 17:57:56 PDT

Java 5, Sun Java System Application Server 9.1_02 (build b04-fcs), Windows

I have a Session Bean that is a Timer bean, in that it has an @Timeout method.

The timer method (eventually) calls another Stateless Session Bean method, and this method is annotated:
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)

THAT method, in time, eventually calls another Stateless Session Bean method, and it, too, is annotated with REQUIRES_NEW.

At some point, this all seemed to work fine.

But now, when I return from the second, inner, REQUIRES_NEW method, I get the IllegalStateException.

Both methods leverage the database through the EntityManager. But I have no idea why I'm getting the IllegalStateException, or what I could do about it to fix the problem.

Attached you will a log.

This log is from when the method in the Timer bean calls the first SessionBean. I have the JTS logger set to FINEST, and it also catches the exceptions.

You can see that we get a "Current thread has been disassociated from control" message immediately, and then we enter the first SSB method. Then we see it next entering the next SSB method. I don't know what "Current thread has been disassociated from control" means, but I'm sort of surprised I don't see if between ENTRY executeSynchronousTask and ENTRY updateStatus, being as they should both be in new transactions.

I'm also interested about the message regarding XAResource, being as we don't use any.

The transaction code isn't the most straightforward to get into coming in blind.

Something must have changed, but I don't quite know what to look for.

Any insight would be appreciated.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=283516