users@glassfish.java.net

Re: java.lang.IllegalStateException for Transaction

From: <glassfish_at_javadesktop.org>
Date: Tue, 01 Jul 2008 15:17:24 PDT

Hi Marina,

I have attached a log with the EJB Container set to FINEST as well.

I suspected the JMS as well, in fact I thought I had that part disabled and was surprised the error was still happening. Apparently I was mistaken.

Here's what we're doing.

We have an AuditListener on our Entities. What we do is we tack on audit information on to an internal AuditContext. We then associate this AuditContext with the transaction.

The intent is that if the transaction commits, we want to then flush audit information out on to a JMS queue. If the transaction rolls back, we don't want to do anything with the audit information.

So, we have a TransactionSynchronizer class that implements Synchronization and is registered with the transaction. In beforeCompletion, assuming everything is OK, we dump the messages to the JMS queue.

To be quite honest this has given us trouble in the past, and it's never been really stable, but I don't quite understand why. It's a bit of complicated code, naturally, but I don't know why we have such issues trying to get this to work.

It might be an XA thing, but I know we had real problems trying to get an XA DB connection working (at least with oracle, this is now under postgres).
[Message sent by forum member 'whartung' (whartung)]

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