Reputation: 507
currently I am working with Activiti Workflow Engine and I am trying to deploy the process programmitically by using Eclipse. However everytime I tried to run the class file as Java Application, I always get following error
Exception in thread "main" java.lang.NullPointerException at createEngine.main(createEngine.java:9)
Here is my Code for the Deployment:
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
public class createEngine {
public static void main(String[] args)
{
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment()
.addClasspathResource("accidentForm.bpmn20.xml")
.deploy();
System.out.println("Number of process definitions: " + repositoryService.createProcessDefinitionQuery().count());
}
}
Moreover, after get this error I tried to print the value of processEngine
by using bellow code:
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
public class createEngine {
public static void main(String[] args)
{
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
System.out.println(processEngine);
}
}
And it return null
value (I don't know whether it is normal or not).
Additional info: The Activiti Workflow Engine running above Tomcat 7 and within Windows 7 environment. Also, for your information, I have also tried to deploy the process by using activiti explorer and it is working without problem, so I am sure there is nothing wrong with my xml file.
I have tried to find some information regarding this problem, but I could not find anything that can be used to solve this problem. Any idea about this problem? Thanks in advance
Upvotes: 0
Views: 1214
Reputation: 621
Do you have activiti.cfg.xml file in your classpath? I recommend to use some logger engine to get more information about Activiti running.
Upvotes: 1