Not able to start a process through the Java API
jmiguel77 Feb 7, 2013 4:12 PMI have succesfully created and deployed a process in BRMS 5.3 standalone server, following this: https://community.jboss.org/message/796593#796593
But now i am facing another problem. I am doing this to obtain a session:
private KnowledgeBase getKnowledgeBuilderKBase(final String changeSetUrl)
throws ProcessRulesException {
try {
Properties properties = new Properties();
properties.setProperty("drools.dialect.java.compiler", "JANINO");
PackageBuilderConfiguration cfg = new PackageBuilderConfiguration(
properties);
JavaDialectConfiguration javaConf = (JavaDialectConfiguration) cfg
.getDialectConfiguration("java");
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder(cfg);
kbuilder.add(ResourceFactory.newUrlResource(changeSetUrl),
ResourceType.CHANGE_SET);
if (kbuilder.hasErrors()) {
System.err.println(kbuilder.getErrors().toString());
}
return kbuilder.newKnowledgeBase();
} catch (Exception e) {
throw new ProcessRulesException(e);
}
}
private KnowledgeBase getKBase(final String changeSetUrl) throws ProcessRulesException {
return getKnowledgeBuilderKBase(changeSetUrl);
}
private StatefulKnowledgeSession getKSession(final String changeSetUrl) throws ProcessRulesException {
StatefulKnowledgeSession ksession = getKBase(changeSetUrl).newStatefulKnowledgeSession();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
return ksession;
}
After getting the session, i am trying to start a process instance with this:
public ProcessInstance startProcess(final String processName, final Map<String, Object> variables) throws ProcessRulesException {
return getKSession(SOME_CHANGESET_URL).startProcess(processName, variables);
}
I am not getting any errors in my junit test, or in the server log; but i always get the same result:
Executing work item WorkItem 1 [name=Human Task, state=0, processInstanceId=1, parameters{TaskName=ResultTask}]
>>>> instance process: VacationRequest Vacation Request
>>>> instance: 1
>>>> instance state 2
But, the process instance is not showing in the jbpm-console, nor is anything created in the database i am using to persist the brms data
If i create a process instance via the jbpm-console, it is created fine, but not via the Java API
What can be happening ?? Am i missing something ??