Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-6144

Fallback for JBossAppServerJtaPlatform.locateUserTransaction() to look at "java:jboss" if "java:comp" not available

    Details

    • Type: Enhancement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate Issue
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JPA / Hibernate
    • Labels:
      None

      Description

      Normally UserTransaction is available in JBoss via JNDI lookup to "java:comp/UserTransaction" . But sometimes this approach does not work (For example if we have custom worker threads in our application or we are starting our AS7 deployment with custom MSC thread before "java:comp" context is available to JNDI)

      So it may be good to fallback to "java:jboss/UserTransaction", which is available in JBoss AS7 even from custom threads.

      Is it possible to change "org.jboss.as.jpa.hibernate4.JBossAppServerJtaPlatform" or "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" to have method locateUserTransaction() similar to this?:

      public static final String AS7_NEW_UT_NAME = "java:jboss/UserTransaction";
      
      @Override
      protected UserTransaction locateUserTransaction() {
         try {
            return (UserTransaction) jndiService().locate(UT_NAME);
         }
         catch(JndiException jndiException) {         
            return (UserTransaction) jndiService().locate(AS7_NEW_UT_NAME);         
         }
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                smarlow Scott Marlow
                Reporter:
                mposolda Marek Posolda
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: