[jboss-user] [JBoss jBPM] - Re: How to save process instance into database?

zhoudengwang do-not-reply at jboss.com
Thu Dec 14 10:16:58 EST 2006


	public long newProcessInstance(
		java.lang.String processName,
		java.util.Map context) throws Exception {
		ProcessInstance pi = null;
		JbpmConfiguration jc = getJbpmConfiguration();
		if (jc == null)
			return -1;
		JbpmContext jct = jc.createJbpmContext();
		try {
			pi = jct.newProcessInstance(processName);
			jct.save(pi);
			jct.close();		} catch (Exception e) {
			log.error("newProcessInstance", e);
		}
		return pi.getId();
	}

error:
22:37:35,922 ERROR [JDBCTransaction] JDBC commit failed
java.sql.SQLException: You cannot commit during a managed transaction!
	at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:432)
	at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:331)
	at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
	at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
	at org.jbpm.svc.Services.close(Services.java:211)
	at org.jbpm.JbpmContext.close(JbpmContext.java:138)
	at ejb.JbpmServiceBean.newProcessInstance(JbpmServiceBean.java:130)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
	at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
	at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
	at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
	at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
	at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
	at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
	at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
	at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
	at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
	at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
	at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
	at org.jboss.ejb.Container.invoke(Container.java:873)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
	at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
	at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
	at sun.rmi.transport.Transport$1.run(Transport.java:153)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
	at java.lang.Thread.run(Thread.java:595)


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

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



More information about the jboss-user mailing list