1 Reply Latest reply on Jun 10, 2009 4:53 AM by jeff.yuchang

    Unabled to enlist resource exception.

    jeff.yuchang

      Hi,

      I am integrating the jBPM and jboss Identity Management projects, and then I had the following exception.

      the scenario is: jBPM has its own HibernateSessionFactory, and the jboss identity Management also use another one HibernateSessionFactory, both two datasource were configured in the XA datasource, the config file is as following (just the jbossidm datasource file):

      What am I doing wrong here???

      Thanks
      Jeff

      <datasources>
      
       <xa-datasource>
       <jndi-name>jbossidmDS</jndi-name>
      
       <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
       <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/pvm</xa-datasource-property>
       <user-name>root</user-name>
       <password></password>
      
      
       <!-- reduce isolation from the default level (repeatable read) -->
       <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
       <!-- separate connections used with and without JTA transaction -->
       <no-tx-separate-pools />
       <!-- disable transaction interleaving -->
       <track-connection-by-tx />
      
       <!--pooling parameters-->
       <min-pool-size>5</min-pool-size>
       <max-pool-size>20</max-pool-size>
       <blocking-timeout-millis>5000</blocking-timeout-millis>
       <idle-timeout-minutes>15</idle-timeout-minutes>
      
      
       <!-- leverage mysql integration features -->
       <exception-sorter-class-name>
       com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
       </exception-sorter-class-name>
       <valid-connection-checker-class-name>
       com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
       </valid-connection-checker-class-name>
      
       <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </xa-datasource>
      
      </datasources>
      


      The hibernate cfg file is:

       <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
       <property name="hibernate.connection.datasource">java:jbossidmDS</property>
       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       <property name="jta.UserTransaction">UserTransaction</property>
      


      The strack trace is as following:

      Caused by: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!;
      - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000001:baaf:4a2cc2f1:dc status: ActionStatus.ABORT_ONLY >);
      - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!;
      - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000001:baaf:4a2cc2f1:dc status: ActionStatus.ABORT_ONLY >))
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
       at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:92)
       at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
       at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
       at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
       at org.hibernate.loader.Loader.doQuery(Loader.java:696)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
       at org.hibernate.loader.Loader.doList(Loader.java:2228)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
       at org.hibernate.loader.Loader.list(Loader.java:2120)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
       at org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:96)
       at org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:88)
       at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
       at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
       at org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:73)
       at org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB.execute(CommandExecutorSLSB.java:102)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
       at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
       at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
       at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
       at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
       at org.jboss.ejb.Container.invoke(Container.java:1029)
       at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
       at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:549)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
      Caused by: org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000001:baaf:4a2cc2f1:dc status: ActionStatus.ABORT_ONLY >)
       at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:409)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConnectionManager2.java:625)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:499)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
       ... 55 more
      Caused by: javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000001:baaf:4a2cc2f1:dc status: ActionStatus.ABORT_ONLY >
       at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.checkEnlisted(TxConnectionManager.java:879)
       at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:675)
       at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:403)
       ... 59 more
      
      


        • 1. Re: Unabled to enlist resource exception.
          jeff.yuchang

          The use case is:

          in the test suite, the jBPM and idm shares one database instance, but I've declared two XA datasource in the jboss, which refer to the same database, named pvm. So I think this combination is very uncommon. If this is the case, we should just have one datasourc, with two hibernte session factory, or either we have two db instance.

          So I tried to use two databases, say db pvm for jBPM, and jbidm for the idm, but it is on the same database, with two different db instances. and then it works ok.

          -Jeff