I tried out a lot of stuff and know now what the problem is. But I don't know how to solve it. The problem is the timer. If I execute the code through for example an user action, there are no errors. If I execute the same code initiated by an expired timer I get this curious "Wrong XAState: 0" error.
Postgres Poolsize and Thread.sleep() during database accesses have no effect.
Could this be an EJB Timer bug?
[Message sent by forum member 'glassfox' (glassfox)]
http://forums.java.net/jive/thread.jspa?messageID=336836