0 Replies Latest reply on Jul 17, 2006 3:08 PM by miro1234

    Unable to locate UserTransaction to check status

    miro1234

      Hello,

      I use org.jboss.hibernate.jmx.Hibernate MBean for my hibernate application with following deploy file:

       <mbean code="org.jboss.hibernate.jmx.Hibernate"
       name="jboss.har:service=Hibernate">
       <depends>jboss.jca:service=RARDeployer</depends>
       <depends>jboss.jca:service=LocalTxCM,name=DerbyDS</depends>
       <attribute name="SessionFactoryName">
       java:/hibernate/SessionFactory
       </attribute>
       <attribute name="DatasourceName">java:DerbyDS</attribute>
       <attribute name="Dialect">
       org.hibernate.dialect.DerbyDialect
       </attribute>
       <attribute name="CacheProviderClass">
       org.hibernate.cache.NoCacheProvider
       </attribute>
       <attribute name="ShowSqlEnabled">true</attribute>
       <!-- attribute name="ScanForMappingsEnabled">true</attribute-->
       </mbean>
      


      I also deploy TransactionManager service via following deploy file:

      <?xml version="1.0" encoding="UTF-8"?>
      <server>
       <mbean code="org.jboss.tm.XidFactory"
       name="jboss:service=XidFactory">
       </mbean>
       <mbean code="org.jboss.tm.TransactionManagerService"
       name="jboss:service=TransactionManager">
       <attribute name="TransactionTimeout">300</attribute>
       <attribute name="GlobalIdsEnabled">true</attribute>
       <depends optional-attribute-name="XidFactory">
       jboss:service=XidFactory
       </depends>
       </mbean>
      </server>
      



      In applications servlet, I'd like to obtain session and begin transaction on it:

       InitialContext ctx=new InitialContext();
       factory=(SessionFactory)ctx.lookup("java:/hibernate/SessionFactory");
      // session = factory.getCurrentSession();
       session=factory.openSession();
       session.getTransaction().begin();
      


      But when calling factory.openSession(), I get
      org.hibernate.TransactionException: Unable to locate UserTransaction to check status

      I also tryed obtaining session by factory.getCurrentSession(), but I got org.hibernate.HibernateException: Unable to locate current JTA transaction



      When using org.hibernate.jmx.HibernateService MBean instead of org.jboss.hibernate.jmx.Hibernate, previous problems do not appear. But using this approach, I have to map resources manually...


      Any help is appreciated.
      Miro