3 Replies Latest reply on Apr 20, 2012 2:09 PM by Scott Marlow

    HornetQ & Extended EntityManager - eliminating the transactional context (JBAS011437)?

    Jon Doe Newbie



      I'm a newbie, "lost in transaction".

      When trying to use my DAO classes from MDB's onMessage, it throws:

      ERROR [stderr] (Thread-11 (HornetQ-client-global-threads-1427426507)) Caused by: javax.ejb.EJBException: JBAS011437: Found extended persistence context in SFSB invocation call stack but that cannot be used because the transaction already has a transactional context associated with it.  This can be avoided by changing application code, either eliminate the extended persistence context or the transactional context.  See JPA spec 2.0 section  Scoped persistence unit name=testapp.war#primary, persistence context already in transaction =ExtendedEntityManager [testapp.war#primary], extended persistence context =ExtendedEntityManager [testapp.war#primary].


      The DAO, from which this exception is thrown, is a SLSB which injects @PersistenceContext(type = PersistenceContextType.EXTENDED) EntityManager em.

      When used from other beans, things work as expected - it only fails when being used from the MDB.


      Now, as the message clearly shows 2 options, I wonder how one would get rid of the transactional context.


      Thanks in advance.




      Running AS, the application is a single .war ["ejb-light"?].