cancel
Showing results for 
Search instead for 
Did you mean: 

Erros on Multiinstance Task

jerome_actility
Champ in-the-making
Champ in-the-making
Hi,

I'm stuck with multi errors during multi instances task run.

- Wildfly server
- Activiti version : 5.21
- ManagedAsyncJobExecutor is used


14:23:05,864 INFO  [org.activiti.engine.impl.db.DbSqlSession] (default task-115) Upgrade needed: 52002 -> 52100. Looking for schema update resource for component 'identity'
14:23:05,864 INFO  [org.activiti.engine.impl.db.DbSqlSession] (default task-115) no schema resource org/activiti/db/upgrade/activiti.mysql.upgradestep.52002.to.52100.identity.sql for upgrade
14:23:05,868 INFO  [org.activiti.engine.impl.asyncexecutor.AbstractAsyncJobExecutor] (default task-115) Starting up the default async job executor [org.activiti.engine.impl.asyncexecutor.ManagedAsyncJobExecutor].
14:23:05,869 INFO  [org.activiti.engine.impl.asyncexecutor.ManagedAsyncJobExecutor] (default task-115) Creating thread pool queue of size 100
14:23:05,869 INFO  [org.activiti.engine.impl.asyncexecutor.ManagedAsyncJobExecutor] (default task-115) Creating executor service with corePoolSize 2, maxPoolSize 10 and keepAliveTime 5000
14:23:05,870 INFO  [org.activiti.engine.impl.asyncexecutor.AcquireTimerJobsRunnable] (Thread-137) starting to acquire async jobs due
14:23:05,870 INFO  [org.activiti.engine.impl.asyncexecutor.AcquireAsyncJobsDueRunnable] (Thread-138) starting to acquire async jobs due


The processes run are the folllowing. I need to process in parallel HTTP request + mail + wait from one side and from the other side, start a Workflow on the HTTP request to release the wait task. The request are send by a Java Delegate task that used EJB lookup.

[IMG]http://img4.hostingpics.net/pics/56015829WF.png[/IMG]

I have 4 annoying errors :

<h1>Null pointer exception</h1>
<blockcode>
Caused by: java.lang.NullPointerException
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:51)
at com.actility.thingpark.smp.bpm.activiti.ActivitiCommandContext.performOperation(ActivitiCommandContext.java:37)
… 94 more
</blockcode>

<h1>ActivitiLockingExeption on variable instance (from activiti engine or script task)</h1>

Same here :
https://forums.activiti.org/content/multi-instance-task-and-activitioptimisticlockingexception


09:10:58,983 INFO  [com.actility.thingpark.smp.control.ProcessHistoryService] (EE-ManagedThreadFactory-default-Thread-7) workflowProcessEndedPrivate end
09:10:58,992 INFO  [com.actility.thingpark.smp.control.ProcessStatusService] (EJB default - 10) onProcessEvent | process id: 45088, key: null, type: END
09:10:58,992 INFO  [com.actility.thingpark.smp.control.ProcessHistoryService] (EJB default - 10) workflowProcessEnded: null, 45088, success, null
09:10:58,996 SEVERE [com.actility.thingpark.smp.control.ActivitiService] (EJB default - 10) : org.activiti.engine.ActivitiOptimisticLockingException: HistoricVariableInstanceEntity[id=44717, name=nrOfActiveInstances, revision=3, type=integer, longValue=4, textValue=4] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:880)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:619)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)


or


16:58:00,093 INFO  [com.actility.thingpark.smp.control.ProcessHistoryService] (EE-ManagedThreadFactory-default-Thread-7) workflowProcessEnded: null, 43858, success, null
16:58:00,117 INFO  [com.actility.thingpark.smp.bpm.activiti.ActilityProcessEngineConfiguration] (EE-ManagedThreadFactory-default-Thread-7) Try to end workflow with processInstanceId: 43858/30331
16:58:00,118 INFO  [com.actility.thingpark.smp.bpm.activiti.ActilityProcessEngineConfiguration] (EE-ManagedThreadFactory-default-Thread-7) : org.activiti.engine.ActivitiOptimisticLockingException: HistoricVariableInstanceEntity[id=41594, name=log, revision=14, type=serializable, byteArrayValueId=41595] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:880)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:619)


or …

<h1>EJB lookup failed despite the Managed Executor Service</h1>


at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:95)
   at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:50)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)
   at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250)
Caused by: java.lang.RuntimeException: lookup failed: java:global/ProcessHistoryService
   at com.actility.thingpark.activiti.ProgrammaticBeanLookup.lookup(ProgrammaticBeanLookup.java:55)
   at com.actility.thingpark.activiti.ProgrammaticBeanLookup.lookup(ProgrammaticBeanLookup.java:48)
   at com.actility.thingpark.smp.bpm.context.StateContext.flushState(StateContext.java:29)
   at jdk.nashorn.internal.scripts.Script$1905$\^eval\_.:program(<eval>:3)
   at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)


<h1>HTTP response received before wait task block</h1>
Currently, to avoid this error, i push the response to a blocking queue and every 10 seconds, i try to fire the signal to the waiting task.
4 REPLIES 4

jerome_actility
Champ in-the-making
Champ in-the-making
An Activiti consultant may be require to help us

jbarrez
Star Contributor
Star Contributor
Those are quite a bit of errors :s

> ActivitiLockingExeption on variable instance
Looking at the diagram, that could be because the workflow in platform 1 hasn't been committed to the DB yet. Ideally, you put something like a queue in front of it, that checks if the process instance is in a correct state before continuing the wait state.

> Null pointer exception
Looking at the offending line … no idea why this could happen … Does it happen always or is it sporadically?

> EJB lookup failed despite the Managed Executor Service

How/where are you doing an EJB lookup? Using managed or not executor should not matter I believe.

> HTTP response received before wait task block

Yes, which is related to the variable error above I think. You'll need to introduce some sort of queue that receives the message and only calls the API when the process instance is ready.
In v6, we added this http://blog.mark-it-zero.com/transaction-dependent-listeners/ to solve this issue (send out the http call on transaction committed).

jerome_actility
Champ in-the-making
Champ in-the-making
Thk for the reply,

> ActivitiLockingExeption on variable instance

I retrieve the execution list with this code:
<code>
List<Execution> executionList = bpmnEngine.getEngine().getRuntimeService().createExecutionQuery()
    .processInstanceId(processInstanceID)
    .activityId(taskName)
    .list();
</code>

Check if the list is empty or not. If empty, push the "processInstanceID" and the "taskName" to a queue and retry every 10 seconds.

How do i check the state ?
<code>execution.isSuspended() ??</code>

> Null pointer exception

It's sporadically but regularly

> EJB lookup failed despite the Managed Executor Service

EJB declaration, stateless or singleton:

<code>
@Stateless
@EJB(name="java:global/ProcessHistoryService", beanInterface=ProcessHistoryService.class)
public class ProcessHistoryService
</code>

or

<code>
@Startup
@Singleton
@EJB(name="java:global/SmpService", beanInterface=SmpService.class)
public class SmpService
</code>

We use EJB lookup with an Util class like this:

<code>
public static Object lookup(String name) {
        try {
            return InitialContext.doLookup("java:global/"+name);
        } catch (NamingException e) {
            throw new RuntimeException("lookup failed: java:global/"+name);
        }
    }
</code>

The result is either a "lookup failed" or "class cast exception"

<code>
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:95)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:50)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250)
Caused by: java.lang.RuntimeException: lookup failed: java:global/ProcessHistoryService
at com.actility.thingpark.activiti.ProgrammaticBeanLookup.lookup(ProgrammaticBeanLookup.java:55)
at com.actility.thingpark.activiti.ProgrammaticBeanLookup.lookup(ProgrammaticBeanLookup.java:48)
at com.actility.thingpark.smp.bpm.context.StateContext.flushState(StateContext.java:29)
at jdk.nashorn.internal.scripts.Script$1905$\^eval\_.Smiley Tonguerogram(<eval>:3)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
</code>
My understanding of "ClasscastException" is my EJB are not load by the right class loader. It's strange, because its sporadic.

jerome_actility
Champ in-the-making
Champ in-the-making
@jbarrez

My reply it's enough to continue?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.