Hello,
Please help me on an error as follows:
I need to save a ProcessInstance from org.jbpm.db.JbpmSession. I obtained an
error as follows: java.lang.UnsupportedOperationException: use
JbpmContext.save(ProcessInstance) instead
Below there are the source code:
package wse.test.jbpm;
|
| import junit.framework.TestCase;
|
| import org.jbpm.db.JbpmSessionFactory;
| import org.jbpm.db.JbpmSchema;
| import org.jbpm.db.JbpmSession;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ProcessInstance;
|
| public class JBPMProcessDefinitionTestC extends TestCase
| {
| public void testJbpmSessionFactory()
| {
|
| // Get a JBPM session connected to a database.
| // create a process definition (from XML) and store it to the
database.
| JbpmSessionFactory jbpmSessionFactory =
JbpmSessionFactory.getInstance();
| JbpmSchema jbpmSchema = new
JbpmSchema(jbpmSessionFactory.getConfiguration());
| jbpmSchema.createSchema();
|
| JbpmSession jbpmSession =
jbpmSessionFactory.openJbpmSessionAndBeginTransaction();
| ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString(
| "<process-definition
name='B'>" +
| " <start-state name='start'>" +
| " <transition to='one' />" +
| " </start-state>" +
| " <state name='one'>" +
| " <transition to='end' />" +
| " </state>" +
| " <end-state name='end' />" +
| "</process-definition>"
| );
|
jbpmSession.getGraphSession().saveProcessDefinition(processDefinition);
| jbpmSession.commitTransactionAndClose();
|
| // Get a JBPM session connected to a database.
| // Reload the previously save definition from the database.
| // start a process instance, move one step, save it to the
database.
| jbpmSession =
jbpmSessionFactory.openJbpmSessionAndBeginTransaction();
| processDefinition =
jbpmSession.getGraphSession().findLatestProcessDefinition("B");
| ProcessInstance processInstance = new
ProcessInstance(processDefinition);
| assertEquals("start",
processInstance.getRootToken().getNode().getName());
| processInstance.signal();
|
jbpmSession.getGraphSession().saveProcessInstance(processInstance);
| jbpmSession.commitTransactionAndClose();
|
The eclipse Failure Trace is:
java.lang.UnsupportedOperationException: use JbpmContext.save(ProcessInstance)
instead
| at org.jbpm.db.GraphSession.saveProcessInstance(GraphSession.java:250)
| at
cwe.test.jbpm.JBPMProcessDefinitionTestB.testJbpmSessionFactory(JBPMProcessDefinitionTestB.java:58)
| 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)
|
I worked with: eclipse 3.1.2, jbpm-starters-kit-3.1, hibernate-3.1,
jboss-4.0.4RC1, jdk1.5.0_06, junit-3.8.1 on XP SP1
Thanks,
Barbu
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3929764#3929764
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3929764
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user