cancel
Showing results for 
Search instead for 
Did you mean: 

10 minute example Fail

r_g
Champ in-the-making
Champ in-the-making
Hello everyone,


just tried to use one of the example processes and i got an error, that i could not fixed.

Can anyone help me ?

I've just created a  Java Project in Eclipse and added the FinancialReportProcess.bpmn20.xml and the TenMinuteTutorial.java Class to the Project. Finally i added the activiti-libs from my running tomcat, so that i can use the project also in the explorer, but unfortunaly i did'nt work.

I added the activiti libs from this folder : apache-tomcat-7.0.59\webapps\activiti-explorer\WEB-INF\lib


My error message is this

log4j:WARN No appenders could be found for logger (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.activiti.engine.ActivitiIllegalArgumentException: resource 'FinancialReportProcess.bpmn20.xml' not found
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:69)
   at tutorial_10_minutes.TenMinuteTutorial.main(TenMinuteTutorial.java:29)


My Code is the following

[java]

package tutorial_10_minutes;

import java.util.List;

import org.activiti.engine.HistoryService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.task.Task;

public class TenMinuteTutorial {

     public static void main(String[] args) {

       // Create Activiti process engine
       ProcessEngine processEngine = ProcessEngineConfiguration
         .createStandaloneInMemProcessEngineConfiguration()
         .buildProcessEngine();

       // Get Activiti services
       RepositoryService repositoryService = processEngine.getRepositoryService();
       RuntimeService runtimeService = processEngine.getRuntimeService();

       // Deploy the process definition
       repositoryService.createDeployment()
         .addClasspathResource("FinancialReportProcess.bpmn20.xml")
         .deploy();

       // Start a process instance
       String procId = runtimeService.startProcessInstanceByKey("financialReport").getId();

       // Get the first task
       TaskService taskService = processEngine.getTaskService();
       List<Task> tasks = taskService.createTaskQuery().taskCandidateGroup("accountancy").list();
       for (Task task : tasks) {
         System.out.println("Following task is available for accountancy group: " + task.getName());

         // claim it
         taskService.claim(task.getId(), "fozzie");
       }

       // Verify Fozzie can now retrieve the task
       tasks = taskService.createTaskQuery().taskAssignee("fozzie").list();
       for (Task task : tasks) {
         System.out.println("Task for fozzie: " + task.getName());

         // Complete the task
         taskService.complete(task.getId());
       }

       System.out.println("Number of tasks for fozzie: "
               + taskService.createTaskQuery().taskAssignee("fozzie").count());

       // Retrieve and claim the second task
       tasks = taskService.createTaskQuery().taskCandidateGroup("management").list();
       for (Task task : tasks) {
         System.out.println("Following task is available for management group: " + task.getName());
         taskService.claim(task.getId(), "kermit");
       }

       // Completing the second task ends the process
       for (Task task : tasks) {
         taskService.complete(task.getId());
       }

       // verify that the process is actually finished
       HistoryService historyService = processEngine.getHistoryService();
       HistoricProcessInstance historicProcessInstance =
         historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
       System.out.println("Process instance end time: " + historicProcessInstance.getEndTime());
     }

   }
[/java]
1 REPLY 1

trademak
Star Contributor
Star Contributor
Are you sure the BPMN XML is available on the classpath? Because it doesn't seem to be.

Best regards,