AnsweredAssumed Answered

failure calling Java ServiceTask

Question asked by arno1 on Apr 11, 2011
Latest reply on Apr 11, 2011 by frederikheremans1
Hello,
I'd like to call a method called doSomething() (it returns a string) from a small Java Class myJavaClass using the java service task. I'd like to use the returned string for showing it in the following user task.
Therefore my process looks like this here:

<process id="myJavaServiceTask" name="myJavaServiceTask">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask2" name="Service Task" activiti:class="org.myJavaClass"
    activiti:resultVariable="varFromJavaTask" activiti:expression="#{myObj.doSomething()}"></serviceTask>
    <sequenceFlow id="flow3" name="" sourceRef="startevent1" targetRef="servicetask2"></sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="flow4" name="" sourceRef="servicetask2" targetRef="usertask1"></sequenceFlow>
    <userTask id="usertask1" name="User Task" activiti:assignee="kermit">
      <documentation textFormat="text/plain">Message from JavaTask: ${varFromJavaTask}</documentation>
    </userTask>
    <sequenceFlow id="flow5" name="" sourceRef="usertask1" targetRef="endevent2"></sequenceFlow>
  </process>


But when I start a process instance in Activiti explorer there comes an exception which tells me that the given class cannot be instanciated: 03110005 Wrapped Exception (with status template): couldn't instantiate class org.myJavaClass

Outcomes