AnsweredAssumed Answered

ClassNotFoundException when using timer start event

Question asked by gunnar1 on Jun 13, 2011
Latest reply on Jul 11, 2011 by sascha1
Hi folks,

I have a process using a timer start event followed by a java service task similar to the following example:

      
      <startEvent id="TestStart" name="TestStart">
          …
         <outgoing>SequenceFlow</outgoing>
         <timerEventDefinition id="sid-a94d4371-18ae-47e9-9fa6-7cd68a92d439">
            <timeCycle id="sid-f1f79392-82d9-4ba8-a510-6ce058ecc0e5" xsi:type="tFormalExpression">0 0/2 * * * ?</timeCycle>
         </timerEventDefinition>
      </startEvent>
      …
      <serviceTask id="TestTask0003" name="TestTask0003"  activiti:class="de.beck.test.delegate.SysoutDelegate">
         …
         <incoming>SequenceFlow</incoming>
         <outgoing>SequenceFlow_2</outgoing>
      </serviceTask>
      …

Using the demo environment (activiti 5.6, changed database to mysql, thats all) I deployed the JAR-File including the above service class to
apache-tomcat-6.0.32\webapps\activiti-rest\WEB-INF\lib

Deploying my process leads to the following somehow odd behavour:

The very first timer event works correctly  :) -  producing test output like

Mon Jun 13 18:34:00 CEST 2011: Execution 116 passes by TestTask0003…

But the next call of the timer (2 minutes later) leads to a ClastCastException:


13.06.2011 18:36:00 org.activiti.engine.impl.interceptor.CommandContext close
SCHWERWIEGEND: Error while closing command context
org.activiti.engine.ActivitiException: couldn't instantiate class de.beck.test.delegate.SysoutDelegate
        at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:131)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.instantiateDelegate(ClassDelegate.java:148)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.getActivityBehaviorInstance(ClassDelegate.java:121)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:102)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListener
Start.java:48)

Caused by: org.activiti.engine.ActivitiClassLoadingException: Could not load class: de.beck.test.delegate.SysoutDelegate
   at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:81)
   at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:128)
   … 69 more
Caused by: java.lang.NoClassDefFoundError: org/activiti/engine/delegate/JavaDelegate
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
   at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1667)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:247)
   at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:62)
   … 70 more
Caused by: java.lang.ClassNotFoundException: org.activiti.engine.delegate.JavaDelegate
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   … 86 more

Starting the process manually via Activiti Explorer is always successful. Any idea about the timer event classloading issue?

Thanks in advance
Gunnar

Outcomes