Hi all !
I'm looking for a way to load my process from the Guvnor Repository. The process has been created in the defaultPackage and according to the Web designer it's valid.
Here's how I am trying to load it:
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
public void startProcess() throws Exception {
KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("admin", aconf);
String fileName = "http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/ChangeSet.xml";
kagent.applyChangeSet(ResourceFactory.newFileResource(fileName));
KnowledgeBase kbase2 = kagent.getKnowledgeBase();
StatefulKnowledgeSession ksession2 = kbase2.newStatefulKnowledgeSession();
ProcessInstance process = ksession2.startProcess("defaultPackage.StartWKFlow");
System.out.println("process "+process.getProcessId()+" " +process.getProcessName());
// start a new process instance
ksession.startProcess("com.sample.bpmn.hello",parameters);
}
Unfortunately I'm unable to retrieve the ProcessInstance as an error "Invaild Process ID" is raised.
Has anybody knowledge how to solve this problem ?
thanks
Mark