AnsweredAssumed Answered

error reading (deserializing) variables from runtimeservice

Question asked by sixtdeu on Nov 3, 2011
Latest reply on Nov 8, 2011 by sixtdeu
Hi there,

I'm new to the forum and to Activiti.

I'm using Activiti 5.8 with GLF3.1 and mysql db.

The situation is: Process with service task storing a variable (simple JavaBean object) an user task reading this variable.

Code service task:
public void execute(DelegateExecution execution) throws Exception {
      ApprovalProcessMail mail = new ApprovalProcessMail();
      mail.setMail_subject("test mail");
      execution.setVariable("testVariable", mail);

}

Code reading variable (stateless ejb method):
public boolean performUserTask() {
      Task task = getTaskService().createTaskQuery().taskAssignee("tester")
            .singleResult();
      ApprovalProcessMail mail = (ApprovalProcessMail) runtimeService
            .getVariable(task.getExecutionId(), "testVariable");
      String s = mail.getMail_subject();
      
      return true;
}

ApprovalProcessMail is a simple java bean with some private fields and getter/setter methods. This class also implements serializable.

My problem:

Exception in thread "main" javax.ejb.EJBException
   at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5193)
   at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5091)
   at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4879)
   at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2039)
   at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1990)
   at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:213)
   at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:79)
   at $Proxy176.performUserTask(Unknown Source)
….

Caused by: org.activiti.engine.ActivitiException: coudn't deserialize object in variable 'testVariable'
   at org.activiti.engine.impl.variable.SerializableType.getValue(SerializableType.java:60)
   at org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.getValue(VariableInstanceEntity.java:158)
   at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:93)
   at org.activiti.engine.impl.cmd.GetExecutionVariableCmd.execute(GetExecutionVariableCmd.java:60)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(RuntimeServiceImpl.java:97)



Caused by: java.lang.ClassNotFoundException: com.mycompany.activiti.classes.ApprovalProcessMail
   at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:787)
   at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:696)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:264)

I've no idea, what the problem could be. All these classes are stored in same eclipse project and deployed within the same ear file.


Any ideas?

Regards,

Chris

Outcomes