1 Reply Latest reply on Jan 24, 2016 2:43 PM by Miguel Z

    JBPM 3.2.10 SP3 with seam 2.3.1 example example for Scheduled Job functionality

    Sreenath Reddy Novice

      Hi All,

      I have upgraded my application from Sean 2.2.0 to Seam 2.3.1. In seam 2.2.0 I am using scheduled jobs which will run hourly, daily, weekly and monthly based on the configuration.

      Earlier I had the below configuration in **jbpm.cfg.xml**

       

       

          <jbpm-configuration>

            <jbpm-context>

              <service name="persistence">

                 <factory>

                    <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">

                       <field name="isTransactionEnabled"><true/></field>

                    </bean>

                 </factory>

              </service>

              <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />

              <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />

              <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />

              <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />

              <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />

            </jbpm-context>

            <string name="resource.mail.templates" value="jbpm.mail.templates.xml" />

            <string name='resource.mail.properties' value='jbpm.mail.properties' />

            <string name='jbpm.mail.from.address' value='eemAdmin@noReply' />

            <string name='jbpm.mail.class.name' value='com.harasoftware.eem.bpm.mail.EmailActionHandler' />

            <bean name='jbpm.mail.address.resolver' class='com.harasoftware.eem.bpm.mail.EmailAddressResolver' singleton='true' />

            <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">

              <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>

              <field name="name"><string value="JbpmJobExecutor" /></field>

              <field name="nbrOfThreads"><int value="1" /></field>

              <field name="idleInterval"><int value="5000" /></field>

              <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->

              <field name="historyMaxSize"><int value="20" /></field>

              <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->

              <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->

              <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->

            </bean>

          </jbpm-configuration>

      After upgrading to seam 2.3.1 observed that the jobs was not scheduling. To resolve this issue I have changed the configuration for service "persistence" to

           <service name="persistence">

                 <factory>

                    <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">

                       <field name="isTransactionEnabled"><true/></field>

                    </bean>

                 </factory>

              </service>

      Now the job was scheduling, but it is throwing an exception because of which my JSF page is navigating to error page. It is throwing the below exception when the job is scheduling.

       

          20:07:06,181 WARN  [org.hibernate.engine.internal.StatefulPersistenceContext] (JbpmJobExecutor@10.182.164.243:Executor-1) HHH000179: Narrowing proxy to class org.jbpm.graph.node.State - this operation breaks ==

          20:07:06,205 INFO  [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (JbpmJobExecutor@10.182.164.243:Executor-1) HHH000106: Forcing container resource cleanup on transaction completion

          20:07:06,216 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (JbpmJobExecutor@10.182.164.243:Executor-1) SQL Error: 0, SQLState: null

          20:07:06,228 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (JbpmJobExecutor@10.182.164.243:Executor-1) The result set is closed.

          20:07:06,326 WARN  [org.hibernate.engine.loading.internal.LoadContexts] (JbpmJobExecutor@10.182.164.243:Executor-1) HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@40b7534e<rs=oracle.jdbc.driver.OracleResultSetImpl@7bd1b257>

          20:07:06,326 WARN  [org.hibernate.engine.loading.internal.CollectionLoadContext] (JbpmJobExecutor@10.182.164.243:Executor-1) HHH000160: On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [1] entries

          20:07:06,327 SEVERE [org.jbpm.job.executor.JobExecutorThread] (JbpmJobExecutor@10.182.164.243:Executor-1) failed to execute Timer(onceOnlySchedule): org.jbpm.graph.def.DelegationException: no applicable exception handler found

          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:368) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_11]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_11]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_11]

          at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_11]

          at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:192) [hibernate-core-4.2.0.jar:4.2.0.Final]

          at org.jbpm.graph.def.ProcessDefinition_$$_jvst745_153.raiseException(ProcessDefinition_$$_jvst745_153.java) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:362) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:283) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_11]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_11]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_11]

          at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_11]

          at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:192) [hibernate-core-4.2.0.jar:4.2.0.Final]

          at org.jbpm.graph.node.State_$$_jvst745_17b.executeAction(State_$$_jvst745_17b.java) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          at org.jbpm.job.Timer.execute(Timer.java:56) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:149) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:51) [jbpm-jpdl.jar:3.2.10.SP3_seam2]

          Caused by: org.hibernate.exception.GenericJDBCException: could not initialize a collection:

       

       

       

      Please let me know if I am missing anything. Also let me know if I can found some example for Seam 2.3.1 with JBPM scheduled jobs.

        • 1. Re: JBPM 3.2.10 SP3 with seam 2.3.1 example example for Scheduled Job functionality
          Miguel Z Newbie

          Dear Sreenath and other wildfly users,

           

          I've got an issue that could be somehow related to the above mentioned one. From time to time (about 1 of 100 requests) I can observe the following non-deterministic transaction cleanup behavior in a Seam 2.3 application running either on wildfly 8 or 9:

           

          -> 1. post request (1 transaction)

           

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) before phase: RESTORE_VIEW 1

          DEBUG [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) beginning transaction prior to phase: RESTORE_VIEW 1

          DEBUG [org.jboss.seam.transaction.UTTransaction] (default task-31*) beginning JTA transaction

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) after phase: RESTORE_VIEW 1

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) before phase: APPLY_REQUEST_VALUES 2

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) after phase: APPLY_REQUEST_VALUES 2

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) before phase: PROCESS_VALIDATIONS 3

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) after phase: PROCESS_VALIDATIONS 3

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) before phase: UPDATE_MODEL_VALUES 4

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) after phase: UPDATE_MODEL_VALUES 4

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) before phase: INVOKE_APPLICATION 5

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) after phase: INVOKE_APPLICATION 5

          DEBUG [org.jboss.seam.jsf.SeamPhaseListener] (default task-31) committing transaction after phase: INVOKE_APPLICATION 5

          DEBUG [org.jboss.seam.transaction.UTTransaction] (default task-31*) committing JTA transaction

           

          -> 2. get after redirect (2 transactions)

           

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-32) before phase: RESTORE_VIEW 1

          DEBUG [org.jboss.seam.jsf.SeamPhaseListener] (default task-32) beginning transaction prior to phase: RESTORE_VIEW 1

          DEBUG [org.jboss.seam.transaction.UTTransaction] (default task-32**) beginning JTA transaction

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-32) after phase: RESTORE_VIEW 1

          DEBUG [org.jboss.seam.jsf.SeamPhaseListener] (default task-32**) committing transaction after phase: RESTORE_VIEW 1

          DEBUG [org.jboss.seam.transaction.UTTransaction] (default task-32) committing JTA transaction

          TRACE [org.jboss.seam.jsf.SeamPhaseListener] (default task-32) before phase: RENDER_RESPONSE 6

          DEBUG [org.jboss.seam.jsf.SeamPhaseListener] (default task-32) beginning transaction prior to phase: RENDER_RESPONSE 6

          DEBUG [org.jboss.seam.transaction.UTTransaction] (default task-32***) beginning JTA transaction

           

          !! JdbcCoordinatorImpl.afterTransaction() is called by task-31 much too late yet during another transaction and is cleaning up foreign resources causing an exception !!

           

          INFO  [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (default task-31*) HHH000106: Forcing container resource cleanup on transaction completion

           

           

          Analyzing the caller stack of JdbcCoordinatorImpl.afterTransaction() where the resource cleanup takes place reveals that org.jboss.seam.transaction.UTTransaction is the last non-container caller element that can be considered part of the webapp.

          As the application manages the beginning and committing of the JTA transactions in sequences it must be some container functionality that postpones the execution of the cleanup or allows the beginning of the next transaction before finishing the cleanup of the last transaction.

           

          Could this be an issue of connection sharing?

           

          I would really appreciate your explications and possible solutions for this behavior.

           

          MiguelZ