cancel
Showing results for 
Search instead for 
Did you mean: 

problem to find JavaDelegate class

ridottiastozze
Champ in-the-making
Champ in-the-making
Hi everyone,
I'm not able to link my java class in execution. I would like to use a simple JavaDelegate class but Tomcat launches the exception:
     caused by: org.activiti.engine.ActivitiClass LoadingException: class not found: packageprovajar.recuperaValori

I write the code:

package packageprovajar;
import org.activiti.engine.delegate.DelegateExecution;

public class recuperaValori implements JavaDelegate {
    
     public void execute(DelegateExecution execution) throws Exception {
       System.out.println("sono in recupera valori");
     }
}

<userTask id="usertask2" name="verifica disponibilita libro1" activiti:candidateGroups="management"></userTask>
    <sequenceFlow id="flow2" name="" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
    <serviceTask id="servicetask1" name="Service Task1" activiti:class="packageprovajar.recuperaValori">
      <extensionElements>
        <activiti:field name="text">
          <activiti:string>Hello World</activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>

I have inserted the .jar in the path  C:\activiti-5.8\apps\apache-tomcat-6.0.32\webapps\activiti-rest\WEB-INF\lib
and in the path C:\activiti-5.8\apps\apache-tomcat-6.0.32\lib  but Tomcat launches always the same exception.
Probably i have inserted the .jar file in the wrong path but i'm not able to find the correct one.
Anyone can help me? thank you.
7 REPLIES 7

trademak
Star Contributor
Star Contributor
Hi,

Are you using the process definition from the Activiti Explorer? Because then you need to add the JAR there as well.

Best regards,

ridottiastozze
Champ in-the-making
Champ in-the-making
Thank you for your answer. I upload the bar file (my bpmn20.xml file) through the webapp user interface. Are you referring to the path: C:\activiti-5.8\apps\apache-tomcat-6.0.32\webapps\activiti-explorer\WEB-INF\lib ? I have tryed to insert the .jar there, but tomcat gives me the same exception. Do you think that I have to set a classpath variable?
ps: Eclipse gives me this the report in the bpmn20.xml file : - cvc-attribute.3: The value 'packageprovajar.recuperaValori' of attribute 'activiti:class' on element 'serviceTask' is not valid with respect to its type, 'null'. It can be related to my problem?
Best regards

trademak
Star Contributor
Star Contributor
Hi,

When you copy the JAR to the activiti-explorer/WEB-INF/lib folder the classes in the JAR file are available in the Activiti Explorer.
Please validate of the contents of the JAR file are correct.

Best regards,

ridottiastozze
Champ in-the-making
Champ in-the-making
hi,
when I validate the eclipse project the compiler doesn't give me any problems or warnings. I have solved the report in the bpmn20.xml file but I'm not able to solve the exception in the Activiti Explorer. I have inserted the .jar file in different directories: C:\activiti-5.8\apps\apache-tomcat-6.0.32\webapps\activiti-explorer\WEB-INF\lib   ,  C:\activiti-5.8\apps\apache-tomcat-6.0.32\webapps\activiti-rest\WEB-INF\lib ,
C:\activiti-5.8\apps\apache-tomcat-6.0.32\lib .   I have the same problem when i use the listeners.
I attach the modified code:
 
<process id="provaJavaDelegate" name="delegateJar">  
    <startEvent id="startevent1" name="Start"></startEvent>  
    <userTask id="usertask1" name="inserimento dati libro1" activiti:candidateGroups="accountancy"></userTask>  
    <userTask id="usertask2" name="verifica disponibilita libro1" activiti:candidateGroups="management"></userTask>    
    <serviceTask id="servicetask1"
        activiti:class="org.activiti.examples.bpmn.servicetask.BackwardsCompatibleExpressionDelegate" name="javaCode">     
</serviceTask>  
   
    <endEvent id="endevent1" name="End"></endEvent>   
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="usertask2" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
  </process>
 
public class BackwardsCompatibleExpressionDelegate implements JavaDelegate {  
   public void execute(DelegateExecution execution) throws Exception {
    System.out.println(" I am in BackwardsCompatibleExpressionDelegate….");
   }
}

and a screen shot of my project

I'm sorry for the numerous messages but I need to solve this problem form my thesis.
best regards,

lisama
Champ in-the-making
Champ in-the-making
How are you creating the jar file? With the "create deployment artefacts" menuitem? That thing has a bug in it as far as I know, it creats jars without a MANIFEST in it. Try the ecplise export option instead.

ridottiastozze
Champ in-the-making
Champ in-the-making
Great,
now it works. I used "the create deployment artefacts" options. Using the export funtionality I'm able to link to java classes. Thank you for your helpfulness.

valarmathi
Champ in-the-making
Champ in-the-making
can u help me.
I have export the jar from the eclipse,then where can i put the file and how can i run it.
Please help me.

Thanks,
Valarmathi P