ERROR JpdlXmlReader : couldn't parse process definition
antitrust1982 Mar 8, 2006 11:13 AMhello,
I try to apply an exemple of task assigment to my problem http://docs.jboss.com/jbpm/v3/userguidesingle/#taskassignmentexample
I have an error that i can't resolve.. how can I resolve it please.
7:00:16,371 [main] INFO JbpmConfiguration : using jbpm configuration resource 'jbpm.cfg.xml'
17:00:17,087 [main] DEBUG JbpmConfiguration : creating jbpm configuration from input stream
17:00:17,802 [main] DEBUG JpdlParser$JpdlEntityResolver : resolving schema reference publicId(null) systemId(http://jbpm.org/jpdl-3.1.xsd)
17:00:17,818 [main] DEBUG JpdlParser$JpdlEntityResolver : providing input source to local 'jpdl-3.1.xsd' resource
17:00:18,191 [main] ERROR JpdlXmlReader : couldn't parse process definition
org.dom4j.DocumentException: Error on line 1 of document : The value of attribute "class" associated with an element type "assignment" must not contain the '<' character. Nested exception: The value of attribute "class" associated with an element type "assignment" must not contain the '<' character. at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.jbpm.jpdl.xml.JpdlParser.parse(JpdlParser.java:57)
at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:138)
at org.jbpm.graph.def.ProcessDefinition.parseXmlString(ProcessDefinition.java:142)
at com.testjbpm.testTaskAssignment.testTaskAssignment(testTaskAssignment.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Nested exception:
org.xml.sax.SAXParseException: The value of attribute "class" associated with an element type "assignment" must not contain the '<' character.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.jbpm.jpdl.xml.JpdlParser.parse(JpdlParser.java:57)
at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:138)
at org.jbpm.graph.def.ProcessDefinition.parseXmlString(ProcessDefinition.java:142)
at com.testjbpm.testTaskAssignment.testTaskAssignment(testTaskAssignment.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
and my typed code is this one:
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.taskmgmt.def.* ;
import org.jbpm.taskmgmt.exe.Assignable;
import org.jbpm.graph.def.*;
import org.jbpm.graph.exe.*;
import org.jbpm.jpdl.xml.*;
import org.jbpm.taskmgmt.exe.TaskInstance;
import junit.framework.TestCase;
public class testTaskAssignment extends TestCase implements AssignmentHandler{
public void testTaskAssignment() {
// The process shown below is based on the hello world process.
// The state node is replaced by a task-node. The task-node
// is a node in JPDL that represents a wait state and generates
// task(s) to be completed before the process can continue to
// execute.
/* java.io.FileReader reader= new java.io.FileReader("D:/worspace amangano eclipse/testjbpm/src/java/testjbpm.par/processdefinition.xml");
JpdlXmlReader test= new JpdlXmlReader(reader);
ProcessDefinition processDefinition = test.readProcessDefinition();*/
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<?xml version='1.0' encoding='UTF-8'?>"+
"<process-definition xmlns='urn:jbpm.org:jpdl-3.1' name='testjbpm'>"+
"<start-state name='start'>"+
" <transition name='creationDA' to='CreationDA'>"+
"</transition>"+
"</start-state>"+
"<task-node name='CreationDA'>"+
"<assignment class='<assignment class='com.testjbpm.testTaskAssignmentHandler' />"+
"<transition name='' to='Analyse DA'></transition>"+
"</task-node>"+
"<task-node name='Analyse DA'>"+
" <transition name='Analyse DA' to='fournisseur existe-t-il?'></transition>"+
"</task-node>"+
"<decision name='fournisseur existe-t-il?'>"+
"<transition name='oui' to='traitement DA' >"+
"</transition>"+
"<transition name='non' to='peut-on réorienter la DA vers fournisseur existant?'>"+
"</transition>"+
"</decision>"+
"<task-node name='traitement DA'>"+
"<transition name='' to='end1'></transition>"+
"</task-node>"+
"<decision name='peut-on réorienter la DA vers fournisseur existant?' expression='oui'>"+
"<transition name='oui' to='traitement DA'>"+
"</transition>"+
"<transition name='non' to='fournisseur existe dans SAP?'>"+
"</transition>"+
"</decision>"+
"<decision name='fournisseur existe dans SAP?' expression='non'>"+
"<transition name='oui' to='envoi email au data manager'>"+
"</transition>"+
"<transition name='non' to='envoi demande màj base fournisseur à l acheteur catégorie'>"
+ "</transition>"+
"</decision>"+
"<task-node name='envoi email au data manager'>"+
"<transition name='' to='Synchronisation base'></transition>"+
"</task-node>"+
"<task-node name='envoi demande màj base fournisseur à l acheteur catégorie'>"+
"<transition name='' to='attente validation de l'acheteur categorie'></transition>"+
"</task-node>"+
"<task-node name='Synchronisation base'>"+
" <transition name='' to='traitement DA'></transition>"+
" </task-node>"+
"<decision name='attente validation de l'acheteur categorie' expression='non'>"+
"<transition name='oui' to='envoi demande màj base fournisseur au data manager'>"+
"</transition>"+
"<transition name='non' to='peut-on réorienter la DA vers fournisseur existant?'>"+
"</transition>"+
" </decision>"+
"<task-node name='envoi demande màj base fournisseur au data manager'>"+
"<transition name='' to='creation fournisseur dans SAP'></transition>"+
" </task-node>"+
"<task-node name='creation fournisseur dans SAP'>"+
"<transition name='' to='traitement DA'></transition>"+
" </task-node>"+
"<end-state name='end1'></end-state>"+
" </process-definition>");
// Create an execution of the process definition.
ProcessInstance processInstance =
new ProcessInstance(processDefinition);
Token token = processInstance.getRootToken();
// Let's start the process execution, leaving the start-state
// over its default transition.
token.signal();
// The signal method will block until the process execution
// enters a wait state. In this case, that is the task-node.
assertSame(processDefinition.getNode("CreationDA"), token.getNode());
// When execution arrived in the task-node, a task 'change nappy'
// was created and the NappyAssignmentHandler was called to determine
// to whom the task should be assigned. The NappyAssignmentHandler
// returned 'papa'.
// In a real environment, the tasks would be fetched from the
// database with the methods in the org.jbpm.db.TaskMgmtSession.
// Since we don't want to include the persistence complexity in
// this example, we just take the first task-instance of this
// process instance (we know there is only one in this test
// scenario).
TaskInstance taskInstance = (TaskInstance)
processInstance
.getTaskMgmtInstance()
.getTaskInstances()
.iterator().next();
System.out.println(taskInstance.getName() );
// Now, we check if the taskInstance was actually assigned to 'papa'.
assertEquals("utilisateur", taskInstance.getActorId() );
//The signal method will block until the process execution
// enters a wait state. In this case, that is the task-node.
assertSame(processDefinition.getNode("Analyse DA"), token.getNode());
// When execution arrived in the task-node, a task 'change nappy'
// was created and the NappyAssignmentHandler was called to determine
// to whom the task should be assigned. The NappyAssignmentHandler
// returned 'papa'.
// In a real environment, the tasks would be fetched from the
// database with the methods in the org.jbpm.db.TaskMgmtSession.
// Since we don't want to include the persistence complexity in
// this example, we just take the first task-instance of this
// process instance (we know there is only one in this test
// scenario).
TaskInstance taskInstance2 = (TaskInstance)
processInstance
.getTaskMgmtInstance()
.getTaskInstances()
.iterator().next();
// Now, we check if the taskInstance was actually assigned to 'papa'.
assertEquals("acheteur", taskInstance.getActorId() );
// Now we suppose that 'utilisateur' has done his duties and mark the task
// as done.
taskInstance.end();
// Since this was the last (only) task to do, the completion of this
// task triggered the continuation of the process instance execution.
assertSame(processDefinition.getNode("end"), token.getNode());
}
public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception {
// TODO Auto-generated method stub
}
}thank you for your help.
antitrust1982