cancel
Showing results for 
Search instead for 
Did you mean: 

How to deploy a simple java service workflow

liuk88
Champ in-the-making
Champ in-the-making
Hi all, i am new on Activiti and i'm tring to deploy my first simple workflow with only a java service.
I saw the documentation and i downloaded the activiti war, tomcat and java.
The first workflow i am doing is a simple xml that calls a java class, that create a file in a my desktop folder.
My idea is to create a new java project(on eclipse) with the .xml and the relative java class.
The xml is like this:

<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
targetNamespace="http://www.activiti.org/bpmn2.0">

  <process id="CreateFile">

    <startEvent id="start" />
    <serviceTask id="servicetask1" name="Service Task" activiti:class="CreateFile"></serviceTask> 
    <endEvent id="theEnd" />
    <sequenceFlow id="flow1" sourceRef="start" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="theEnd" />
 
</process>
</definitions>

The java class is a simple class like this:

public class CreateFile implements JavaDelegate
{
   @Override
   public void execute(DelegateExecution execution) throws Exception
   {
      //create the file…
    }
}

Done this, i don't know how to deploy the "package" of this two files.
My questions are:

-Is right to make a java project like this?
-If yes, how i can deploy all to test it? (i know that i can deploy the xml with activiti explorer but the related java class?)

Thanks all!
6 REPLIES 6

liuk88
Champ in-the-making
Champ in-the-making
The xml is here:
<process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task" activiti:class="CreateFile"></serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
  </process>

liuk88
Champ in-the-making
Champ in-the-making
Xml in attachment..

martin_grofcik
Confirmed Champ
Confirmed Champ
Related java class has to be in the jvm classpath (e.g. create jar and add it to tomcat's classpath )

liuk88
Champ in-the-making
Champ in-the-making
Hi martin, i tried before to do a jar(with the deploy of activiti project in eclipse) and i put it into apache-tomcat/webapps/activiti-explorer/WEB-INF/lib but when i restart tomcat i don't find the workflow in activiti-explorer. Did i miss something/wrong folder?
Thanks

liuk88
Champ in-the-making
Champ in-the-making
Now i uploaded(after the jar) the xml with charge deployment in activiti and now i see the process and it works with the class; is this the correct way? I need to deploy before the jar with class and xml in tomcat and then  the xml in activiti-explorer?

martin_grofcik
Confirmed Champ
Confirmed Champ
Explorer by default works with in memory DB. Deployments and identities are generated on the startup. That's why you have to redeploy.

Regards
Martin