0 Replies Latest reply on Oct 24, 2009 4:34 AM by Denis Cossutta

    Commit fails using JBoss applications server Transaction Man

    Denis Cossutta Newbie

      I'm currently using the Jboss cache version 1.4.1 togheter with the jboss application server 4.2.2 (the chaceh version is the one shiped by default on this application server version). I configured the cache .xml file to use the JDBC Class loader to make the cache persistent towards a database.
      My use case is the following one: an external client application calls a method of a stateless session bean, which is deployed on the jboss application server. This stateless bean method looks up the local cache and puts inside the cache an element and finally it returns a value to the client application.
      As a first step, I didn't configure the cache to use a Transaction manager, so the cache started without transaction support. This time, when I tried to test the use case, everything worked fine: the stateless bean method is called, it inserts an element in the cache and it returns the value. As result I can see also the persisted element in the database. Obviously, since there is no transaction support, if a runtime exception occurs during the stateless bean method execution, the cache insertion process will be not rolled back.
      Therefore as a second step I set up the cache to use the JBoss Transaction manager (defined in the cache configuration file to use JBossTransactionManagerLookup) and I tested again the use case. But this time I get an exception when the application tries to commit: Transaction is not ACTIVE (obviously as result, the cache element is not persisted on the database). This exception occurs at the end, when the stateless session bean method has ended without exception and the JBoss application server tries to commit the operation (the insertion of the element of the cache) on the database using the TWO-PHASE-COMMIT protocol. If I put the logging on TRACE level I can clearly see that when the stateless session bean method is executing the operations and the cache is altered, there is a global transaction used, but at the end when it's time to commit, the server throws the exception saying that the transaction is not anymore active. Do you have any idea of the reason of the exception? Can it be linked to the fact that I'm using the REPLY_ASYNC
      cache mode?