[
http://jira.jboss.com/jira/browse/JBPM-895?page=comments#action_12392258 ]
Michael Thiele commented on JBPM-895:
-------------------------------------
I had a hard time solving this problem. It's not a bug, it's just not well
designed...
You don't have to do some kind of bug fix like replacing above said code.
You have to make sure, that the sub-process is already deployed, when the main process is
being parsed from your processdefinition.xml file.
So things like this won't work:
ProcessDefinition pdload_sub = ProcessDefinition.parseXmlResource("sub.xml");
ProcessDefinition pdload_caller =
ProcessDefinition.parseXmlResource("main.xml");
context.deployProcessDefinition(pdload_sub);
context.deployProcessDefinition(pdload_caller);
Instead you have to do it that way:
ProcessDefinition pdload_sub = ProcessDefinition.parseXmlResource("sub.xml");
context.deployProcessDefinition(pdload_sub);
ProcessDefinition pdload_caller =
ProcessDefinition.parseXmlResource("main.xml");
context.deployProcessDefinition(pdload_caller);
That's sometimes not that easy, since these method calls can be distributed different
classes etc., but keep in mind, that resolving the sub-process definition from the given
name takes place during parsing, not during deployment of the main process!
Besides what Tom B. posted is right for the issue description: parsing of the definition
xml has to take place after a JbpmContext has been created. After deployment of the
ProcessDefinition it will be persisted with the jbpmContext.close(); in the finally block.
If you parse outside the try block (that is without having created a JbpmContext) JBPM
won't find the persisted sub-process referenced in the main process definition.
null pointer when create new sub process definition
---------------------------------------------------
Key: JBPM-895
URL:
http://jira.jboss.com/jira/browse/JBPM-895
Project: JBoss jBPM
Issue Type: Bug
Components: BPEL
Affects Versions: jBPM 3.1.3
Reporter: Tom Nguyen
Assigned To: Tom Baeyens
Attachments: DbSubProcessResolver.java
I have a problem with my process composition
Exception happen when deploying process with sub process:
public void deployProcessDefinition() {
ProcessDefinition processDefinition =
ProcessDefinition.parseXmlResource("main/processdefinition.xml");
ProcessInstance instance = new ProcessInstance(processDefinition);
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
jbpmContext.deployProcessDefinition(processDefinition);
} finally {
jbpmContext.close();
}
}
java.lang.NullPointerException: can't create a process instance when
processDefinition is null
at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:87)
at org.jbpm.graph.exe.Token.createSubProcessInstance(Token.java:571)
at org.jbpm.graph.node.ProcessState.execute(ProcessState.java:109)
at org.jbpm.graph.def.Node.enter(Node.java:316)
<?xml version="1.0" encoding="UTF-8"?>
<process-definition
xmlns="urn:jbpm.org:jpdl-3.1" name="main">
<start-state name="start">
</start-state>
<end-state name="end"></end-state>
<process-state name="sub">
<sub-process name="sub"/>
</process-state>
</process-definition>
This is my sub process:
<?xml version="1.0" encoding="UTF-8"?>
<process-definition
xmlns="urn:jbpm.org:jpdl-3.1" name="sub">
<start-state name="start">
</start-state>
<end-state name="end"></end-state>
</process-definition>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira