0 Replies Latest reply on Oct 15, 2001 3:47 AM by Dave Elliot

    Runtime exceptions in transaction blocks...

    Dave Elliot Newbie

      Hi all,

      I am wondering how runtime exceptions should be handled when writing a transactional block (begin...commit/rollback) in a BMT session bean. Currently if a Runtime exception is thrown it bubbles straight out of the business method and the following error appears on the JBoss console:

      Application error: BMT stateless bean MyBean should complete transactions before returning (ejb1.1 spec, 11.6.1)

      No mention is made of the Runtime error that caused the 'return' to take place (in my case it was a NullPointer).

      To catch runtime exceptions and handle them with a 'rollback' should I be encasing everything in a try-catch that catches and rethrows any exception after first rolling back the current transaction?

      Or should JBoss be rolling back the transaction automatically when an exception bubbles out of the block, and be passing back this exception rather than complaining about the spec violation as above ?

      Dazed and confused,