Embedded mode process instance creation fails with org.xmlpull.v1.XmlPullParserException ERROR in VariableScope.validateVariable on top of RHPAM 7.13.0 GA release
Environment
- Red hat Process Automation Manager (OCP)
- 7.13.0 GA
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.4.5
Issue
During a workflow creation using embedded mode on RHPAM 7.13.0, the following org.xmlpull.v1.XmlPullParserException exception is thrown:
18:26:55,046 ERROR [org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerImpl] (ForkJoinPool-2-worker-2) Unexpected error during processing : com.thoughtworks.xstream.io.StreamException:
at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.io.xml.XppReader.(XppReader.java:63) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1284) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1275) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
at org.jbpm.process.core.datatype.impl.type.ObjectDataType.readValue(ObjectDataType.java:94) [jbpm-flow-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
at org.jbpm.process.core.context.variable.VariableScope.validateVariable(VariableScope.java:113) [jbpm-flow-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
at org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:61) [jbpm-flow-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:311) [jbpm-flow-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
at org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:293) [jbpm-flow-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
at org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:225) [jbpm-flow-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:215) [jbpm-flow-7.67.0.Final-redhat-00008.jar:7.67.0.Final-redhat-00008]
used by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not 2 (position: START_DOCUMENT seen 2... @1:2)
at io.github.xstream.mxparser.MXParser.parseProlog(MXParser.java:1528) [mxparser-1.2.2.jar:1.2.2]
at io.github.xstream.mxparser.MXParser.nextImpl(MXParser.java:1406) [mxparser-1.2.2.jar:1.2.2]
at io.github.xstream.mxparser.MXParser.next(MXParser.java:1104) [mxparser-1.2.2.jar:1.2.2]
at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109) [xstream-1.4.19.redhat-00001.jar:1.4.19.redhat-00001]
... 84 more
This error is happening when calling
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess.
Resolution
In RHPAM 7.13.0 GA version, FQCN (Fully Qualified Class Name) is mandatory when declaring custom data in bpmn file.
Modify "Date" to "java.util.Date" in BPMN file.
<bpmn2:itemDefinition id="ItemDefinition_1" isCollection="false" structureRef="String"/>
<bpmn2:itemDefinition id="ItemDefinition_2" isCollection="false" structureRef="Integer"/>
<bpmn2:itemDefinition id="ItemDefinition_3" isCollection="false" structureRef="Boolean"/>
<bpmn2:itemDefinition id="ItemDefinition_52" isCollection="false" structureRef="Date"/>
<bpmn2:itemDefinition id="ItemDefinition_25" isCollection="false" structureRef="Object"/>
<bpmn2:itemDefinition id="ItemDefinition_15" isCollection="false" structureRef="java.util.Map"/>
A best practice would be for each variable declared in the BPMN to contain its FQCN.
Java wrapper primitive types are implicitly completed with java.lang.* package if not specified.
Root Cause
The org.xmlpull.v1.XmlPullParserException is caused by the id=”_dateInItem” variable that has been declared in the bpmn2 :
The JBPM engine doesn't recognize the StructureRef=”Date” as a known type as it misses the java.util FQCN (Fully Qualified Class Name).
Diagnostic Steps
- Create a Business Process ( BPMN2 ) with a variable declaration of type "Date"
- Deploy the KJAR on JBPM - Create a container
- Create a process instance of the process created before
The creation is expected to fail with org.xmlpull.v1.XmlPullParserException exception
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments