0 Replies Latest reply on Nov 7, 2011 7:01 PM by waldsgbq

    Database reconnect failed for JBoss/JBPM

    waldsgbq

      We are using JBoss-5.1.0.GA, JBPM 4.4 and Oracle 11g.

      When we try to test the database reconnect abilities (by disconnecting the network connection between JBoss and the Oracle server),

      After reestablishing the network connection, JBPM doesn't reconnect properly. Starting a new business process instance ends in an exception:

      2011-11-07 17:34:34,041 ERROR [pool-24-thread-2] (Log4jLog.java:42) failed to execute job: 10500

      org.jbpm.api.JbpmException: invalid transaction state: STATUS_ROLLING_BACK

      at org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:59)

      at org.jbpm.pvm.internal.tx.JtaRetryInterceptor.executeWithoutRetry(JtaRetryInterceptor.java:56)

      at org.jbpm.pvm.internal.tx.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:48)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)

      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)

      at org.jbpm.pvm.internal.jobexecutor.JobParcel.run(JobParcel.java:48)

      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

      at java.util.concurrent.FutureTask.run(FutureTask.java:138)

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

      at java.lang.Thread.run(Thread.java:619)

       

      Has anyone any idea on how to ensure that JBPM's job executor proceeds processing new jobs (and ideally

      jobs that got interrupted) after a database connection interrupt?

       

      We would expect, that JBoss's managed connection pool takes care of connections affected by the interrupt.

       

       

      Here the listing of datasource (jbpm-oracle-ds.xml)

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <!-- ===================================================================== -->

      <!--                                                                       -->

      <!--  JBoss Server Configuration                                           -->

      <!--                                                                       -->

      <!-- ===================================================================== -->

       

      <!-- $Id: jbpm-oracle-ds.xml 4458 2009-04-06 14:36:41Z heiko.braun@jboss.com $ -->

       

      <!-- ===================================================================== -->

      <!-- ATTENTION:  DO NOT FORGET TO SET Pad=true IN transaction-service.xml  -->

      <!-- ===================================================================== -->

       

      <datasources>

        <xa-datasource>

          <jndi-name>JbpmDS</jndi-name>

          <track-connection-by-tx></track-connection-by-tx>

          <check-valid-connection-sql>select count(*) from dual</check-valid-connection-sql>

       

          <!-- uncomment to enable interleaving <interleaving/> -->

          <isSameRM-override-value>false</isSameRM-override-value>

          <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

          <xa-datasource-property name="URL">jdbc:oracle:thin:@127.0.0.1:1521:JBPMDB</xa-datasource-property>

          <xa-datasource-property name="User">USER</xa-datasource-property>

          <xa-datasource-property name="Password">PASSWORD</xa-datasource-property>

       

          <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->

          <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->

          <!-- Checks the Oracle error codes and messages for fatal errors -->

          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

       

          <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->

          <no-tx-separate-pools/>

       

          <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

          <metadata>

              <type-mapping>Oracle9i</type-mapping>

          </metadata>

        </xa-datasource>

       

        <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"

               name="jboss.jca:service=OracleXAExceptionFormatter">

          <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>

        </mbean>

       

      </datasources>