[JBoss jBPM] - Timer on node clarification
by o_lion
Hi all,
I'm beginner. I have a problem.
I put a timer and an action on a node, but the timer never start.
To start the timer do I have to modify anything? What can i do, have you got any idea?
I have Jboss 4.2.3 GA and JBPM jbpm-3.2.6.SP1.
My deployed process is:
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2"
name="processname">
<start-state name="init">
</start-state>
test
getValue
<end-state name="finish"></end-state>
</process-definition>
I execute the process in my web application so:
JbpmContext context= JbpmConfiguration.getInstance().createJbpmContext();
try {
Map <String , Object> variables= new HashMap<String, Object>();
JbpmInputsParameter inputs= new JbpmInputsParameter();
variables.put("inputsBean", inputs);
System.out.println("Start process: "+Calendar.getInstance().getTime());
ProcessInstance instance = context.newProcessInstance("process name");
instance.addInitialContextVariables(variables);
while (!instance.hasEnded()) {
System.out.println("I'm in state "+instance.getRootToken().getNode().getName());
instance.signal();
}
System.out.println("End process: "+Calendar.getInstance().getTime());
System.out.println("The result is: "+instance.getContextInstance().getVariable("result"));
} catch (Exception e) {
e.printStackTrace();
}finally{
context.close();
}
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224684#4224684
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224684
16 years, 12 months
[JBoss jBPM] - Re: JEE AS / jBPM / Transactions problem
by gchanteb
If really don't understand, if i use this:
public void launchSimpleProcess(String processName, String clientId) throws LaunchProcessException
| {
| long processId;
|
| try
| {
| processId = createProcess(processName); // Creation of the process.
| }
| catch(CreationProcessException exc) { throw new LaunchProcessException(exc.getMessage()); }
| }
And if i have my entity beans on the same db (ie "JbpmDS" in persistence.xml), if i launch this method with a remote main:
Sometime it works:
14:37:25,727 INFO [STDOUT] Hibernate:
| /* named HQL query GraphSession.findLatestProcessDefinitionQuery */ select
| *
| from
| ( select
| processdef0_.ID_ as ID1_10_,
| processdef0_.NAME_ as NAME3_10_,
| processdef0_.DESCRIPTION_ as DESCRIPT4_10_,
| processdef0_.VERSION_ as VERSION5_10_,
| processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_10_,
| processdef0_.STARTSTATE_ as STARTSTATE7_10_
| from
| JBPM_PROCESSDEFINITION processdef0_
| where
| processdef0_.NAME_=?
| order by
| processdef0_.VERSION_ desc )
| where
| rownum <= ?
| 14:37:25,727 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:25,727 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:25,727 INFO [STDOUT] Process id: 8
| 14:37:25,727 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:25,727 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:25,727 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:25,727 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:25,727 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:25,727 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.graph.exe.Token
| */ insert
| into
| JBPM_TOKEN
| (VERSION_, NAME_, START_, END_, NODEENTER_, NEXTLOGINDEX_, ISABLETOREACTIVATEPARENT_, ISTERMINATIONIMPLICIT_, ISSUSPENDED_, LOCK_, NODE_, PROCESSINSTANCE_, PARENT_, SUBPROCESSINSTANCE_, ID_)
| values
| (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.graph.exe.ProcessInstance
| */ insert
| into
| JBPM_PROCESSINSTANCE
| (VERSION_, KEY_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_, ID_)
| values
| (?, ?, ?, ?, ?, ?, ?, ?, ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.context.exe.ContextInstance
| */ insert
| into
| JBPM_MODULEINSTANCE
| (VERSION_, PROCESSINSTANCE_, CLASS_, ID_)
| values
| (?, ?, 'C', ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.context.exe.TokenVariableMap
| */ insert
| into
| JBPM_TOKENVARIABLEMAP
| (VERSION_, TOKEN_, CONTEXTINSTANCE_, ID_)
| values
| (?, ?, ?, ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.bytes.ByteArray
| */ insert
| into
| JBPM_BYTEARRAY
| (NAME_, ID_)
| values
| (?, ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.context.exe.variableinstance.ByteArrayInstance
| */ insert
| into
| JBPM_VARIABLEINSTANCE
| (VERSION_, NAME_, CONVERTER_, TOKEN_, TOKENVARIABLEMAP_, PROCESSINSTANCE_, BYTEARRAYVALUE_, CLASS_, ID_)
| values
| (?, ?, ?, ?, ?, ?, ?, 'B', ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.taskmgmt.exe.TaskMgmtInstance
| */ insert
| into
| JBPM_MODULEINSTANCE
| (VERSION_, PROCESSINSTANCE_, TASKMGMTDEFINITION_, CLASS_, ID_)
| values
| (?, ?, ?, 'T', ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* update
| org.jbpm.graph.exe.ProcessInstance */ update
| JBPM_PROCESSINSTANCE
| set
| VERSION_=?,
| KEY_=?,
| START_=?,
| END_=?,
| ISSUSPENDED_=?,
| PROCESSDEFINITION_=?,
| ROOTTOKEN_=?,
| SUPERPROCESSTOKEN_=?
| where
| ID_=?
| and VERSION_=?
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* update
| org.jbpm.graph.exe.Token */ update
| JBPM_TOKEN
| set
| VERSION_=?,
| NAME_=?,
| START_=?,
| END_=?,
| NODEENTER_=?,
| NEXTLOGINDEX_=?,
| ISABLETOREACTIVATEPARENT_=?,
| ISTERMINATIONIMPLICIT_=?,
| ISSUSPENDED_=?,
| LOCK_=?,
| NODE_=?,
| PROCESSINSTANCE_=?,
| PARENT_=?,
| SUBPROCESSINSTANCE_=?
| where
| ID_=?
| and VERSION_=?
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert collection
| row org.jbpm.bytes.ByteArray.byteBlocks */ insert
| into
| JBPM_BYTEBLOCK
| (PROCESSFILE_, INDEX_, BYTES_)
| values
| (?, ?, ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert collection
| row org.jbpm.bytes.ByteArray.byteBlocks */ insert
| into
| JBPM_BYTEBLOCK
| (PROCESSFILE_, INDEX_, BYTES_)
| values
| (?, ?, ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* insert collection
| row org.jbpm.bytes.ByteArray.byteBlocks */ insert
| into
| JBPM_BYTEBLOCK
| (PROCESSFILE_, INDEX_, BYTES_)
| values
| (?, ?, ?)
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* create one-to-many row org.jbpm.graph.exe.ProcessInstance.instances */ update
| JBPM_MODULEINSTANCE
| set
| PROCESSINSTANCE_=?,
| NAME_=?
| where
| ID_=?
| 14:37:25,758 INFO [STDOUT] Hibernate:
| /* create one-to-many row org.jbpm.graph.exe.ProcessInstance.instances */ update
| JBPM_MODULEINSTANCE
| set
| PROCESSINSTANCE_=?,
| NAME_=?
| where
| ID_=?
|
Sometime it doesn't work:
14:37:19,337 INFO [STDOUT] Hibernate:
| /* named HQL query GraphSession.findLatestProcessDefinitionQuery */ select
| *
| from
| ( select
| processdef0_.ID_ as ID1_10_,
| processdef0_.NAME_ as NAME3_10_,
| processdef0_.DESCRIPTION_ as DESCRIPT4_10_,
| processdef0_.VERSION_ as VERSION5_10_,
| processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_10_,
| processdef0_.STARTSTATE_ as STARTSTATE7_10_
| from
| JBPM_PROCESSDEFINITION processdef0_
| where
| processdef0_.NAME_=?
| order by
| processdef0_.VERSION_ desc )
| where
| rownum <= ?
| 14:37:19,337 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:19,337 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:19,337 INFO [STDOUT] Process id: 1
| 14:37:19,337 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:19,337 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:19,337 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:19,337 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:19,337 INFO [STDOUT] Hibernate:
| select
| hibernate_sequence.nextval
| from
| dual
| 14:37:19,352 INFO [STDOUT] Hibernate:
| /* insert org.jbpm.graph.exe.Token
| */ insert
| into
| JBPM_TOKEN
| (VERSION_, NAME_, START_, END_, NODEENTER_, NEXTLOGINDEX_, ISABLETOREACTIVATEPARENT_, ISTERMINATIONIMPLICIT_, ISSUSPENDED_, LOCK_, NODE_, PROCESSINSTANCE_, PARENT_, SUBPROCESSINSTANCE_, ID_)
| values
| (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
| 14:37:19,368 WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
| 14:37:19,368 ERROR [JDBCExceptionReporter] ORA-00001: violation de contrainte unique (JBPM.SYS_C005977)
|
| 14:37:19,368 WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
| 14:37:19,368 ERROR [JDBCExceptionReporter] ORA-00001: violation de contrainte unique (JBPM.SYS_C005977)
|
| 14:37:19,368 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
| org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
| at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
| at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
| at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
| at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
| at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2252)
| at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2688)
| at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
| at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:88)
| at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:263)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
| at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1414)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
| at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
| at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:487)
| at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
| at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
| Caused by: java.sql.BatchUpdateException: ORA-00001: violation de contrainte unique (JBPM.SYS_C005977)
|
| at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:674)
| at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9394)
| at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
| at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeBatch(CachedPreparedStatement.java:476)
| at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:774)
| at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
| at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
| ... 48 more
| 14:37:19,368 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@13fa39d
| org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
| at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
| at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
| at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
| at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
| at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2252)
| at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2688)
| at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
| at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:88)
| at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:263)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
| at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1414)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
| at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
| at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:487)
| at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
| at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
| Caused by: java.sql.BatchUpdateException: ORA-00001: violation de contrainte unique (JBPM.SYS_C005977)
|
| at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:674)
| at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9394)
| at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
| at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeBatch(CachedPreparedStatement.java:476)
| at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:774)
| at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
| at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
| ... 48 more
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224672#4224672
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224672
16 years, 12 months
[JBoss jBPM] - Re: Hibernate Error when persist the outer ProcessInstance.
by kenees
"boercher" wrote : Obviously creation of ProcessInstances involves the database. I've looked up the ProcessInstance constructor:
|
| public ProcessInstance(ProcessDefinition processDefinition, Map<String, Object> variables, String key)
| | {
| | [...]
| | // if this process instance is created in the context of a persistent operation
| | Services.assignId(this);
| | [...]
| | }
| |
| You are surely operating in the context of a persistent operation so this call to this static method of Services (I guess these are the services from the jbpm.cfg.xml) will do some Hibernate stuff.
|
| Since jBPM heavily relies on a database for everything (transaction safety, logging, ...) I would guess that it will be hard to work around that by other means than by crude hacks.
|
| Volker
Yes, Volker, you are right. What I have to do is to extend from the ProcessInstance to create a new type of ProcessInstance -- NonPersistProcessInstance. Code would like:
| public NonPersistProcessInstance(ProcessDefinition processDefinition,
| Map variables, String key) {
|
| if (processDefinition == null)
| throw new JbpmException(
| "can't create a process instance when processDefinition is null");
|
| // initialize the members
| this.processDefinition = processDefinition;
| this.rootToken = new Token(this);
| this.start = Clock.getCurrentTime();
| this.key = key;
|
| // if this process instance is created in the context of a persistent
| // operation
| // DO NOT PERSIST
| //Services.assignId(this);
|
| // create the optional definitions
| Map definitions = processDefinition.getDefinitions();
| // if the state-definition has optional definitions
| if (definitions != null) {
| instances = new HashMap();
| // loop over each optional definition
| Iterator iter = definitions.values().iterator();
| while (iter.hasNext()) {
| ModuleDefinition definition = (ModuleDefinition) iter.next();
| // and create the corresponding optional instance
| ModuleInstance instance = definition.createInstance();
| if (instance != null) {
| addInstance(instance);
| }
| }
| }
|
| // add the creation log
| rootToken.addLog(new ProcessInstanceCreateLog());
|
| // set the variables
| ContextInstance contextInstance = getContextInstance();
| if ((contextInstance != null) && (variables != null)) {
| contextInstance.addVariables(variables);
| }
|
| Node initialNode = rootToken.getNode();
| // fire the process start event
| if (initialNode != null) {
| ExecutionContext executionContext = new ExecutionContext(rootToken);
| processDefinition.fireEvent(Event.EVENTTYPE_PROCESS_START,
| executionContext);
|
| // execute the start node
| initialNode.execute(executionContext);
| }
|
| }
|
I commented the "assignId" method call in the constructor, this seems to be rude, but I don't know if there is any better idea...
Thank you Volker.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224657#4224657
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224657
16 years, 12 months
[JBoss jBPM] - JEE AS / jBPM / Transactions problem
by gchanteb
Hi,
I'm trying to implemente a simple jBPM use case in JBoss AS, so using JEE.
First i made two ear for my tests:
- One with an EJB which just launch a jbpm process and use DB "JbpmDS", which is an XA datasource.
- A second with an EJB which update data (with entity beans - persistence.xml) using DB "JbpmDSClient", which is an XA datasource.
That worked fine separatly.
But, i wanted to make them work together in only one ear, to call an EJB-remote method which launches a simple process BUT with an update in database.
And i don't know why but:
1 - If i use the same db in persistence.xml that in jbpm config (=> "JbpmDS"), i have sometime an error when i try to only launch a process (without update in DB), (it's not always the same):
anonymous wrote : ORA-00001: violation de contrainte unique (JBPM.SYS_C005943)
| ..
| or ORA-00001: violation de contrainte unique (JBPM.SYS_C005904) for example
It's like there was a conflict between jbpm config and my persistence.xml config for my entity beans.
2 - If i try to use a different DB in persistence.xml, i have this error when i try to only launch a process (without update in DB):
anonymous wrote : 12:31:43,629 WARN [JDBCExceptionReporter] SQL Error: 2289, SQLState: 42000
| 12:31:43,629 ERROR [JDBCExceptionReporter] ORA-02289: la s????????????????????????????????quence n'existe pas (the sequence doesn't exist)
So.... I would like to know if somebody got an idea? What is the best practice to work with jBPM and to update DB in the same time? What about transactions?
What about the context.close?
I found this paper: http://www.jboss.org/community/docs/DOC-11090 which explains how use CMT with jBPM....
I would like to know how to properly inject my hibernate session from persistence.xml in jBPM context... and what is really the good config?
In the wiki for example they said to have this conf:
<jbpm-context>
| <service name="persistence" factory="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory" />
| </jbpm-context>
But sometime i read to put (here for example http://www.jboss.org/index.html?module=bb&op=viewtopic&t=111429&postdays=...):
<service name="persistence">
| <factory>
| <bean name="persistence.factory"
| class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
| <field name="isTransactionEnabled">
| <false />
| </field>
| </bean>
| </factory>
| </service>
And in the doc, chapter 7.4 http://docs.jboss.com/jbpm/v3.2/userguide/html_single/ this is 2nd choice whereas in 9.2, this is the first.
That's why i'm a bit lost... I have read too much different things..... I just want to do this in the same ejb method:
1- launch a process.
2- update in db.
3- rollback the 2 actions if i have a problem.
Here is the code of my ejb "ManagementJBPM":
package **package** ;
|
| import javax.ejb.EJB;
| import javax.ejb.Stateless;
|
| import org.jbpm.JbpmConfiguration;
| import org.jbpm.JbpmContext;
| import org.jbpm.db.GraphSession;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.exe.ProcessInstance;
| import org.jbpm.persistence.db.DbPersistenceService;
| import org.jbpm.persistence.jta.JtaDbPersistenceService;
|
| import **package**.ManagementClientLocal;
| import **package**.CreationProcessException;
| import **package**.LaunchProcessException;
| import **package**.NoClientDefinedException;
|
| @Stateless
| public class ManagementJBPM implements ManagementJBPMRemote
| {
| private static JbpmConfiguration jBPMConfiguration = null;
|
| @EJB(mappedName="JBPMBusiness-ear/ManagementClient/local-**package**.ManagementClientLocal")
| private ManagementClientLocal managementClient;
|
| public void launchSimpleProcess(String processName, String clientId) throws LaunchProcessException
| {
| long processId;
|
| try
| {
| processId = createProcess(processName); // Creation of the process.
| }
| catch(CreationProcessException exc) { throw new LaunchProcessException(exc.getMessage()); }
|
| try
| {
| managementClient.updateClient(clientId, processId); // Update of client infos.
| }
| catch(NoClientDefinedException exc) { throw new LaunchProcessException(exc.getMessage()); }
| }
|
| private long createProcess(String processName) throws CreationProcessException
| {
| JbpmContext jbpmContext = initJBPMContext(); // Creation of the context.
|
| Long processId = null;
|
| try
| {
| ProcessInstance processInstance = jbpmContext.newProcessInstance(processName); // Process created.
| processId = processInstance.getId();
| }
| catch(Exception exc)
| {
| throw new CreationProcessException("Error during the creation of the process ");
| }
| finally
| {
| jbpmContext.close(); // It's necessary to close the context.
| }
|
| return processId;
| }
|
| private JbpmContext initJBPMContext()
| {
| if(jBPMConfiguration==null) // If jBPMConfiguration doesn't exist.
| {
| jBPMConfiguration = JbpmConfiguration.getInstance(); // We get it.
| }
| JbpmContext jbpmContext = jBPMConfiguration.createJbpmContext(); // Creation of the context.
| // jbpmContext.setSession(persServ.getSessionFactory().getCurrentSession());
| return jbpmContext;
| }
| }
(All the exceptions have ApplicationException(rollback=true))
Here is my persistence.xml conf for my entity beans:
<?xml version="1.0" encoding="UTF-8"?>
| <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
| <persistence-unit name="clientdb" transaction-type="JTA">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:JbpmDS</jta-data-source>
| <properties>
| <!-- Dialect and schema check -->
| <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
| <property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
| <!-- logging properties -->
| <property name="hibernate.show_sql" value="true" />
| <property name="hibernate.format_sql" value="true" />
| <property name="hibernate.use_sql_comments" value="true" />
| <property name="hibernate.generate_statistics" value="true" />
| </properties>
| </persistence-unit>
| </persistence>
Here is my jbpm.cfg.xml:
<jbpm-configuration>
|
| <jbpm-context>
| <service name="persistence" factory="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory" />
| <service name="message" factory="org.jbpm.msg.jms.JmsMessageServiceFactory" />
| <service name="scheduler" factory="org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory" />
| <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
| <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
| </jbpm-context>
|
| <string name="jbpm.classLoader" value="context" />
|
| <null name="jbpm.job.executor" />
|
| </jbpm-configuration>
Here is my JbpmDS:
<?xml version="1.0" encoding="UTF-8"?>
|
| <datasources>
| <xa-datasource>
|
| <jndi-name>JbpmDS</jndi-name>
|
| <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
| <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521</xa-datasource-property>
| <xa-datasource-property name="User">jBPM</xa-datasource-property>
| <xa-datasource-property name="Password">adminadmin</xa-datasource-property>
|
| <isSameRM-override-value>false</isSameRM-override-value>
|
| <!--
| <min-pool-size>10</min-pool-size>
| <max-pool-size>100</max-pool-size>
| -->
|
| <!--
| <background-validation>true</background-validation>
| <background-validation-millis>60000</background-validation-millis>
| -->
|
| <!--
| <idle-timeout-minutes>15</idle-timeout-minutes>
| -->
|
| <no-tx-separate-pools/>
|
| <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
| <stale-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleStaleConnectionChecker</stale-connection-checker-class-name>
|
| <!--
| <use-fast-fail>true</use-fast-fail>
| -->
|
| <prepared-statement-cache-size>200</prepared-statement-cache-size>
| <share-prepared-statements/>
|
| <metadata>
| <type-mapping>Oracle9i</type-mapping>
| </metadata>
| </xa-datasource>
|
| <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
| name="jboss.jca:service=OracleXAExceptionFormatter">
| <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
| </mbean>
|
| </datasources>
My 2nd DS is the same with an other name.
And here is my hibernate.cfg.xml:
<hibernate-configuration>
| <session-factory>
|
| <!-- hibernate dialect -->
| <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
|
| <!-- DataSource properties -->
| <property name="hibernate.connection.datasource">java:JbpmDS</property>
|
| <!-- JTA transaction properties -->
| <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
| <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
|
| <!-- Simple memory-only cache -->
| <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
|
If somebody have an answer, i take it :p
Thx.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224629#4224629
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224629
16 years, 12 months