Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-4618

Thread context classloader not set during transaction commit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • No Release
    • None
    • None
    • None

      I modified a serializable object, part of an EJB3 Entity, during an MDB.onMessage() call. Hibernate attempts to update this serializable object during the transaction commit, but fails because it cannot load the class from the classloader. For example, if one modifies an entity such as:

      @Entity
      public class Foo {
      Serializable bar;
      ...
      }

      in an MDB

      public class MDB implements MessageListener {
      @PersistenceContext
      EntityManager em;
      public void onMessage()

      { Foo f = em.load(...); f.setBar(new ScopedClass()); }

      }

      you get this error.

      The thread context classloader is assigned when processing the message. Is it cleared after message processing or after transaction completion? From my limited understanding of the code, it seems like the former. There appears to be an invoker that sets and clears during processing, but the clear apparently happens before transaction commit.

      Ordinarily, transaction commit does not require the context classloader of the .ear file, but in this case it does.

              Unassigned Unassigned
              genman_jira Elias Ross (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: