3 Replies Latest reply on Jul 6, 2009 3:09 PM by Radim Chlad

    org.jboss.util.NestedSQLException: Could not enlist in trans

    Advait Newbie

      I have a jar file having following hibernate.cfg.xml

       <property name="hibernate.current_session_context_class">thread</property>
       <property name="connection.datasource">java:MyDS</property>
       <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       <property name="show_sql">true</property>
       <property name="hbm2ddl.auto">update</property>
       <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
       <mapping resource="Ticker.hbm.xml" ></mapping>
      


      MyDS is defined as:

      <datasources>
       <local-tx-datasource>
       <jndi-name>AutoworldDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/myds?autoReconnect=true</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>xxx</user-name>
       <password>xxx</password>
       <min-pool-size>0</min-pool-size>
       <max-pool-size>20</max-pool-size>
       <idle-timeout-minutes>300</idle-timeout-minutes>
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <dialect>org.hibernate.dialect.MySQLDialect</dialect>
       </local-tx-datasource>
      </datasources>
      


      when I try to get hibernate session factory using:

      Configuration conf = new Configuration().configure();
       return conf.buildSessionFactory();
      


      I am getting these exceptions:
      19:52:38,843 WARN [SettingsFactory] Could not obtain connection metadata
      org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!; - nested throwabl
      e: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. t
      x=TransactionImple < ac, BasicAction: -53eb9fe6:4a3:47595665:106 status: ActionStatus.ABORT_ONLY >); - nested throwa
      ble: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - n
      ested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previo
      us warnings. tx=TransactionImple < ac, BasicAction: -53eb9fe6:4a3:47595665:106 status: ActionStatus.ABORT_ONLY >))
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
       at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)