using jbpm in EJB bean for testing. please help
yxyang Aug 4, 2006 4:27 AMHi,
I am new to JBPM.
what is the error messsage mean? "object references an unsaved transient instance".
I have the following code:
public void ejbCreate() throws CreateException {
log.debug("ejbCreate() is called");
JbpmConfiguration config = null;
try {
InitialContext ic = new InitialContext();
config = (JbpmConfiguration) ic
.lookup("java:/jbpm/JbpmConfiguration");
JbpmContext context = config.createJbpmContext();
log.debug("config="+config);
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <start-state>" +
" <transition to='s' />" +
" </start-state>" +
" <state name='s'>" +
" <transition to='end' />" +
" </state>" +
" <end-state name='end' />" +
"</process-definition>"
);
// The next line creates one execution of the process definition.
// After construction, the process execution has one main path
// of execution (=the root token) that is positioned in the
// start-state.
ProcessInstance processInstance =
new ProcessInstance(processDefinition);
Token token = processInstance.getRootToken();
// Also after construction, the main path of execution is positioned
// in the start-state of the process definition.
log.debug(""+processDefinition.getStartState().equals(token.getNode()));
token.signal();
log.debug(""+processDefinition.getNode("s").equals(token.getNode()));
token.signal();
log.debug(""+processDefinition.getNode("end").equals(token.getNode()));
} catch (NamingException ne) {
log
.error(
"JbpmConfiguration was not found using JNDI. Is the SAR setup and deployed?",
ne);
throw new CreateException(
"Cannot find JbpmConfiguration. Make sure jbpm.sar is configured correctly.");
// config = JbpmConfiguration.parseResource(SERVICE_CONFIG);
// try {
// InitialContext ic = new InitialContext();
// ic.bind(SERVICE_JNDI, config);
// } catch (NamingException ne2) {
// log.error("Unable to bind JbpmConfiguration for services", ne2);
// throw new CreateException(
// "Could not bind JbpmConfiguration for services");
// }
}
}
In addition, i have a servlet to create the instance of this session bean.
But the following error happened:
16:14:13,981 DEBUG [JbpmServiceManagerBean] true
16:14:13,982 DEBUG [GraphElement] event 'before-signal' on 'State(s)' for 'Token(/)'
16:14:13,982 DEBUG [GraphElement] event 'node-leave' on 'State(s)' for 'Token(/)'
16:14:13,983 DEBUG [GraphElement] event 'transition' on 'Transition(8ab10c)' for 'Token(/)'
16:14:13,983 DEBUG [GraphElement] event 'node-enter' on 'EndState(end)' for 'Token(/)'
16:14:13,984 DEBUG [GraphElement] event 'process-end' on 'ProcessDefinition(6da7d4)' for 'Token(/)'
16:14:13,985 DEBUG [DbPersistenceServiceFactory] creating persistence service
16:14:13,985 DEBUG [DbPersistenceService] creating hibernate session
16:14:13,986 DEBUG [DbPersistenceService] beginning hibernate transaction
16:14:13,996 ERROR [SchedulerSession] org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.exe.ProcessInstance
16:14:13,998 ERROR [LogInterceptor] EJBException in method: public abstract com.ternary.wirelessthermometer.JbpmServiceManagerLocal com.ternary.wirelessthermometer.JbpmServiceManagerLocalHome.create() throws javax.ejb.CreateException, causedBy:
javax.ejb.EJBException: null; CausedByException is:
Please help!
yang
Why tr