Process Not Found After successful deployment

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2012 02:32 PM
I have picked up a sample bookorder process from Activitii book and deployed it in my MYSQL database using following code:
String resource = "activiti.cfg.xml";
File f = new File("c:/apache-tomcat-6.0.20/conf/RN/" + resource);
FileInputStream stream = new FileInputStream(f);
ProcessEngine processEngine = ProcessEngineConfiguration
.createProcessEngineConfigurationFromInputStream(stream)
.buildProcessEngine();
System.err.println("Got process Engine");
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
String deployID = repositoryService.createDeployment()
.addZipInputStream(new ZipInputStream(new FileInputStream("C:/temp/bpmn-examples/src/main/resources/chapter1/bookorder.bpmn20.xml")))
.deploy().getId();
System.err.println("Deploy " + deployID);
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("isbn", "123456");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
"bookorder", variableMap);
The system successfully gives me deployID but the instantiation fails, saying no processes deployed with key 'bookorder'. I have also tried starting the process using Deploy ID but that also fails.
I checked the database tables and the only entry I found was in act_re_deployment table, no other table had reference to this process. Can anyone help me understand what is going wrong here?
String resource = "activiti.cfg.xml";
File f = new File("c:/apache-tomcat-6.0.20/conf/RN/" + resource);
FileInputStream stream = new FileInputStream(f);
ProcessEngine processEngine = ProcessEngineConfiguration
.createProcessEngineConfigurationFromInputStream(stream)
.buildProcessEngine();
System.err.println("Got process Engine");
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
String deployID = repositoryService.createDeployment()
.addZipInputStream(new ZipInputStream(new FileInputStream("C:/temp/bpmn-examples/src/main/resources/chapter1/bookorder.bpmn20.xml")))
.deploy().getId();
System.err.println("Deploy " + deployID);
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("isbn", "123456");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
"bookorder", variableMap);
The system successfully gives me deployID but the instantiation fails, saying no processes deployed with key 'bookorder'. I have also tried starting the process using Deploy ID but that also fails.
I checked the database tables and the only entry I found was in act_re_deployment table, no other table had reference to this process. Can anyone help me understand what is going wrong here?
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2012 01:11 AM
I have found the answer:
Two mistakes:
1. I should have used FileInputStream, not ZipInputStream.
2. In File Input Stream, The resource name should match the full file name.
Here is the example:
ok, I have found the answer. The deployment can be done using addInputStream. The key thing is resourceName parameter should exactly match the full file name including path.
Here is the example:
String deployID = repositoryService.createDeployment()
.addInputStream("C:/temp/bpmn-examples/src/main/resources/chapter4/bookorder15.java.bpmn20.xml",new FileInputStream("C:/temp/bpmn-examples/src/main/resources/chapter4/bookorder15.java.bpmn20.xml"))
.deploy().getId();
Two mistakes:
1. I should have used FileInputStream, not ZipInputStream.
2. In File Input Stream, The resource name should match the full file name.
Here is the example:
ok, I have found the answer. The deployment can be done using addInputStream. The key thing is resourceName parameter should exactly match the full file name including path.
Here is the example:
String deployID = repositoryService.createDeployment()
.addInputStream("C:/temp/bpmn-examples/src/main/resources/chapter4/bookorder15.java.bpmn20.xml",new FileInputStream("C:/temp/bpmn-examples/src/main/resources/chapter4/bookorder15.java.bpmn20.xml"))
.deploy().getId();
