[jboss-user] [JBoss jBPM] - Trying to persist process instances - need some help

terigox do-not-reply at jboss.com
Fri Jan 2 10:59:29 EST 2009


Hi All,

I'm new to jBpm here and have been trying to follow some of the guides on the JBoss site as well as some examples included in the Jbpm distribution. I've successfully created some simple examples and am now trying to work with some DB persistence.

I am using Jboss 5, JBpm 3.3. The Mysql database has been created using the DB scripts included in the starter kit.

I have a simple process definition defined as follows:

  | <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="TestProcess">  
  | 
  | 
  | 	<start-state name="start">
  | 		<transition to="auction" name="to-auction"></transition>
  | 	</start-state>
  | 
  | 	<decision name="meets-minimum">
  | 		<handler class="com.test.decision.AcceptBid"></handler>
  | 		<transition to="end" name="yes"></transition>
  | 		<transition to="auction" name="no"></transition>
  | 	</decision>
  | 
  | 	<state name="auction">
  | 		<transition to="enter-bid" name="to-bid"></transition>
  | 	</state>
  | 
  | 	<task-node name="enter-bid">
  | 		<task name="make-bid">
  | 			<controller></controller>
  | 		</task>
  | 		<transition to="meets-minimum" name="to-meets-minimum"></transition>
  | 	</task-node>
  | 
  | 
  | 	<end-state name="end"></end-state>
  | 
  | 
  | </process-definition>
  | 

I am trying to use the process by doing:

  | 		JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("jbpm.cfg.xml");
  | 		JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
  | 		
  | 		try{
  | 			log.debug("Test main - Creating process definition.");
  | 			ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("TestProcess/processdefinition.xml");
  | 			log.debug("Test main - deploying process definition");
  | 			jbpmContext.deployProcessDefinition(processDefinition);
  | 			log.debug("Test main - Creating process instance");
  | 			ProcessInstance processInstance = jbpmContext.newProcessInstance("TestProcess");
  | 			log.debug("Test main - signaling process instance");
  | 			log.debug("Test main - Process instance in state: "+ processInstance.getRootToken().getNode().getName());
  | 			processInstance.signal();
  | 		}
  | 		finally
  | 		{
  | 			jbpmContext.close();
  | 		}
  | 

The jbpm.cfg.xml is simple (following one of the examples)

  | <jbpm-configuration>
  | <jbpm-context>
  | 	<service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />
  | </jbpm-context>
  | </jbpm-configuration>
  | 

When I try to execute the code above, I get the following exception with this root cause:


  | org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.jbpm.graph.def.Node.id
  | 	org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:58)
  | 	org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:67)
  | 	org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:67)
  | 
  | Root Cause
  | 
  | java.lang.IllegalArgumentException: Can not set long field org.jbpm.graph.def.GraphElement.id to org.jbpm.graph.node.MailNode
  | 	sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
  | 	sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
  | 	sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
  | 	sun.reflect.UnsafeLongFieldAccessorImpl.getLong(UnsafeLongFieldAccessorImpl.java:42)
  | 	sun.reflect.UnsafeLongFieldAccessorImpl.get(UnsafeLongFieldAccessorImpl.java:18)
  | 	java.lang.reflect.Field.get(Field.java:358)
  | 


I get the same problem when I use the Hsql database as well.

What's puzzling me is that when I do not initialize my own context, the process seems to run fine (although my processes do not persist in my database).

Can anyone help shed light on this for me? Thanks for any help!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199247#4199247

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199247



More information about the jboss-user mailing list