2 Replies Latest reply on May 24, 2006 12:44 PM by Stjepan Matijasevic

    Unable to locate UserTransaction in 4.0.4GA

    Stjepan Matijasevic Newbie

      After migration from 4.0.4RC1 to 4.0.4GA I get TransactionException for simple entityManager.createQuery("FROM Foo.class") in a stateless session bean.

      Here is the stack trace:

      org.hibernate.TransactionException: Unable to locate UserTransaction to check status
       at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:86)
       at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:180)
       at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:158)
       at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:1850)
       at org.hibernate.impl.SessionImpl.isOpen(SessionImpl.java:322)
       at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:407)
       at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:70)
       at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:36)
       at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:37)
      ...


      Please advise!
      Thanks, Stjepan


        • 2. Re: Unable to locate UserTransaction in 4.0.4GA
          Stjepan Matijasevic Newbie

          Hi Emmanuel,

          sorry for not replying sooner.

          My app worked on 4.0.4RC1.
          I installed 4.0.4GA (jboss-4.0.4.GA-Patch1-installer.jar) with EJB3, changed ArroundInvoke and InvocationContext's package to javax.interceptor (following the EJB3 FR spec and jboss-ejb3x.jar), and deployed the app. First access to stateless session bean where I tried to fetch data from DB resulted in exception as described in my previous post.

          Apart from interceptors' package, nothing else was changed in the code.

          Transaction and other settings are all defaults as described by EJB3 spec (no extra annotations). Interceptors are not used on that particular session bean. The bean has both local and remote interfaces.

          Code that breaks is in method getAll:

           @PersistenceContext(unitName = "hxloan")
           EntityManager em;
          
           @SuppressWarnings("unchecked")
           public <T> Collection<T> getAll(Class<T> entityClass) {
           return createQuery(entityClass).getResultList();
           }
          
           private Query createQuery(Class<?> entityClass) {
           return em.createQuery("FROM " + entityClass.getName());
           }
          


          Client is desktop app accessing server via Context.lookup. I copied all the necessary libraries (such as jbossall-client.jar, hibernate*.jar, ...) from the AS, so they should be synchronized.

          Best regards,
          Stjepan