Jose Miguel Loor [
https://community.jboss.org/people/jmiguel77] created the discussion
"Not able to start a process through the Java API"
To view the discussion, visit:
https://community.jboss.org/message/796653#796653
--------------------------------------------------------------
I have succesfully created and deployed a process in BRMS 5.3 standalone server, following
this:
https://community.jboss.org/message/796593#796593
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
https://community.jboss.org/message/796653#796653#796653/name=Human Task, state=0,
processInstanceId=1, parameters{TaskName=ResultTask} Not able to start a process through
the Java API
>>>> 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 ??
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/796653#796653]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]