cancel
Showing results for 
Search instead for 
Did you mean: 

org.activiti.engine.ActivitiException: couldn't instantiate class com.stud.listener.PrinterListener

natedawg
Champ in-the-making
Champ in-the-making
Hi,

I did try to read other similar forum posts reported on this forum but I cannot see if those are exactly the same as mine issue. So here I go. Process is attached, ending as txt as xmls are not allowed to be uploaded.

The process starts with executing a service task (SequenceJob1) calling a java class. Then the process sleeps for 10 seconds (intermediate timer catching event, wait10S) so I can check the status of SequenceJob1 in another service task (CheckSequenceJob1Status). If the job is not finished (varStatus == 'F') then the loop of sleeping for 10 secs and checking status is repeated again. The error occurs right after the second time intermediate timer catching event executes. It manages to execute the PrinterListener (like the first time) but then throws exception (see below log).


<b>From the log</b> (take a look at 12:43:55,28 when a new thread is fired.

12:43:23,490 [http-apr-8080-exec-10] INFO  org.activiti.engine.impl.bpmn.deployer.BpmnDeployer  - Processing resource ProcDS1.bpmn20.xml
12:43:36,997 [http-apr-8080-exec-8] INFO  com.stud.service.StageService  - starting Stage job execution
12:43:38,202 [http-apr-8080-exec-8] INFO  com.stud.service.StageService  - execution completed
12:43:38,202 [http-apr-8080-exec-8] INFO  com.stud.service.StageService  - Variable name: varLastActivity
12:43:38,202 [http-apr-8080-exec-8] INFO  com.stud.service.listener.PrinterListener  - Activity name:wait10S    variables: [varLastActivity]
12:43:55,281 [pool-1-thread-2] INFO  com.stud.service.listener.PrinterListener  - Activity name:CheckSeqJob1Status    variables: [varLastActivity]
12:43:55,297 [pool-1-thread-2] INFO  com.stud.service.StageService  - checking job status
12:43:55,297 [pool-1-thread-2] INFO  com.stud.service.StageService  - calling getJobStatus
12:43:55,593 [pool-1-thread-2] INFO  com.stud.service.StageService  - checking job status completed. value equals 'R'
12:43:55,593 [pool-1-thread-2] INFO  com.stud.service.StageService  - Variable name: varLastActivity
12:43:55,593 [pool-1-thread-2] INFO  com.stud.service.listener.PrinterListener  - Activity name:wait10S    variables: [varLastActivity, varDSJobStatus]



<b>Exception:</b>

12:43:55,693 [pool-2-thread-2] ERROR org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable  - Job 127578 failed
org.activiti.engine.ActivitiException: couldn't instantiate class com.stud.service.listener.PrinterListener
        at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:137)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.defaultInstantiateDelegate(ClassDelegate.java:242)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.instantiateDelegate(ClassDelegate.java:232)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.getExecutionListenerInstance(ClassDelegate.java:103)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.notify(ClassDelegate.java:95)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:42)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:80)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:116)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:35)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:636)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:629)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:453)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:431)
        at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:140)
        at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:66)
        at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
        at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47)
        at org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBehavior.signal(IntermediateCatchEventActivityBehavior.java:27)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:410)
        at org.activiti.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:58)
        at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:85)
        at org.activiti.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:95)
        at org.activiti.engine.impl.cmd.ExecuteAsyncJobCmd.execute(ExecuteAsyncJobCmd.java:52)
        at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
        at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:96)
        at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:50)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)
Caused by: org.activiti.engine.ActivitiClassLoadingException: Class not found: com.stud.service.listener.PrinterListener
        at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:87)
        at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:134)
        … 58 more
Caused by: java.lang.ClassNotFoundException: com.stud.service.listener.PrinterListener
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
        at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270)
        at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:291)
        at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:68)
        … 59 more
14 REPLIES 14

natedawg
Champ in-the-making
Champ in-the-making
I found the problem.  Before I continue I have to correct my previous post where I stated that after changing engine.activate.jobexecutor=true the process became stable. That was pure luck, first 2/3 runs were successful but after re-running the same process 10-15 times they all failed.

The solution was to add service.jar to activiti-rest lib-folder as well. I thought activiti-explorer and activiti-rest were independent of each other so service.jar was added only to activiti-explorer. I first noticed my process running 100% successfully when I moved activi-explorer to a new Tomcat installation webapps-dir. As soon I added activiti-rest the problem reoccurred. How are those two web apps related besides sharing same DB instance?

Pls, also answer on my previous post where I ask why we should use JobExecutor and not AsyncExecutor in case of the timer? Only one executor at the time is allowed?

Kind regards
A.H.

trademak
Star Contributor
Star Contributor
Hi,

The Activiti Explorer and REST webapps are independent yes. But both can have an enabled job executor, so when you enable the job executor on the REST webapp, you'll need the classpath to have all service task classes as well.

Best regards,

natedawg
Champ in-the-making
Champ in-the-making
Thx for the response Tijs,

Can you pls share some light on  JobExecutor vs. AsyncExecutor in case of the timers? Am I absolutely tied to using JobExecutor in case of timers as we can only allow one executor to be enabled in the Explorer?

Kind regards
A.H.

jbarrez
Star Contributor
Star Contributor
"Am I absolutely tied to using JobExecutor in case of timers as we can only allow one executor to be enabled in the Explorer?"

No, you can simply reconfigure the engine to use the Async executor instead of the job executor. Running both is bound to lead to a lot of optimistic locking exceptions.

For timers, there is not that much difference between the two. The performance improvements are generally more in the area of the async executions.

jbarrez
Star Contributor
Star Contributor
See my answer to the duplicate of your question.