[jBPM Users] - Re: Violation of unique constraint with two splits (JBPM-255
by Alkero
Process:
<?xml version="1.0" encoding="UTF-8"?>
|
| <process name="TwoForks" xmlns="http://jbpm.org/4.0/jpdl">
| <start g="179,17,32,29" name="start1">
| <transition g="-43,-18" name="to fork1" to="fork1"/>
| </start>
| <fork g="185,95,49,50" name="fork1">
| <transition name="left" to="task1" g="-44,-18"/>
| <transition name="right" to="task2" g="-44,-18"/>
| </fork>
| <end g="193,606,38,33" name="end1"/>
| <task name="task1" g="90,177,73,44">
| <transition name="to fork2" to="fork2" g="-43,-18"/>
| </task>
| <task name="task2" g="249,172,83,48">
| <transition name="to join2" to="join2" g="288,425:-41,-18"/>
| </task>
| <task name="task3" g="21,313,88,45">
| <transition name="to join1" to="join1" g="-41,-18"/>
| </task>
| <task name="task4" g="154,313,88,48">
| <transition name="to join1" to="join1" g="-41,-18"/>
| </task>
| <fork name="fork2" g="108,250,37,28">
| <transition name="left" to="task3" g="-44,-18"/>
| <transition name="right" to="task4" g="-44,-18"/>
| </fork>
| <join name="join1" g="112,407,51,31">
| <transition name="to join2" to="join2" g="-41,-18"/>
| </join>
| <join name="join2" g="192,511,57,44">
| <transition name="to end1" to="end1" g="-42,-18"/>
| </join>
| </process>
Unit Test:
package org.jbpm.examples.fork;
|
| import java.util.Date;
| import java.util.List;
|
| import org.jbpm.api.ProcessInstance;
| import org.jbpm.api.task.Task;
| import org.jbpm.test.JbpmTestCase;
|
| import junit.framework.TestCase;
|
| public class TwoForksTest extends JbpmTestCase {
|
|
| String deploymentId;
|
| protected void setUp() throws Exception {
| super.setUp();
|
| deploymentId = repositoryService.createDeployment()
| .addResourceFromClasspath("org/jbpm/examples/fork/process.jpdl.xml")
| .deploy();
| }
|
| protected void tearDown() throws Exception {
| repositoryService.deleteDeploymentCascade(deploymentId);
|
| super.tearDown();
| }
|
| public void testTwoForks(){
| ProcessInstance processInstance = executionService.startProcessInstanceByKey("TwoForks");
| List<Task> tasks = taskService.createTaskQuery().list();
| for(Task task:tasks){
| taskService.completeTask(task.getId());
| }
| Date endTime = historyService
| .createHistoryProcessInstanceQuery()
| .processInstanceId(processInstance.getId())
| .uniqueResult()
| .getEndTime();
|
| assertNotNull(endTime);
| }
|
| }
|
Log:
16:07:07,015 SEV | [BaseJbpmTestCase] TEST THROWS EXCEPTION: could not update: [org.jbpm.pvm.internal.model.ExecutionImpl#14]
| org.hibernate.exception.ConstraintViolationException: could not update: [org.jbpm.pvm.internal.model.ExecutionImpl#14]
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
| at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2453)
| at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
| at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
| at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
| 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:168)
| 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.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:56)
| at org.jbpm.pvm.internal.tx.StandardTransaction.commit(StandardTransaction.java:106)
| at org.jbpm.pvm.internal.tx.StandardTransaction.complete(StandardTransaction.java:65)
| at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:61)
| at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
| at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
| at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
| at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
| at org.jbpm.pvm.internal.svc.TaskServiceImpl.completeTask(TaskServiceImpl.java:88)
| at org.jbpm.examples.fork.TwoForksTest.testTwoForks(TwoForksTest.java:35)
| 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:164)
| at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)
| at junit.framework.TestCase.runBare(TestCase.java:130)
| 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:120)
| at junit.framework.TestSuite.runTest(TestSuite.java:230)
| at junit.framework.TestSuite.run(TestSuite.java:225)
| at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
| Caused by: java.sql.SQLException: Violation of unique constraint $$: duplicate value(s) for column(s) $$: SYS_CT_9890 in statement [update JBPM4_EXECUTION set DBVERSION_=?, ACTIVITYNAME_=?, PROCDEFID_=?, HASVARS_=?, NAME_=?, KEY_=?, ID_=?, STATE_=?, SUSPHISTSTATE_=?, PRIORITY_=?, HISACTINST_=?, PARENT_=?, INSTANCE_=?, SUPEREXEC_=?, SUBPROCINST_=? where DBID_=? and DBVERSION_=?]
| at org.hsqldb.jdbc.Util.throwError(Unknown Source)
| at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
| at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
| ... 38 more
Regards,
David
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267063#4267063
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267063
16 years, 4 months
[jBPM Users] - Re: Can't get pooled task instance list with jbpm & seam - p
by achimh
Ok, I missed the "real answer" for my thread-problem :D
As the annotation do not work the provided seam-objects like pooledTaskInstanceList do not work either. Therefore I had to write a bean that provides this information. It could look like this:
| @Name("taskManager")
| @Stateless
| public class TaskManagerBean implements TaskManagerLocal {
|
| ...
|
| /** Stores the process engine instance. */
| private ProcessEngine processEngine = new Configuration().buildProcessEngine();
|
| /** Stores the user's identity. */
| @In
| private Identity identity;
|
| /** Stores a list of tasks that are assigned to the current user. */
| @DataModel
| private List<Task> assignedTasks;
|
| /** Stores the currently selected assigned Task. */
| @DataModelSelection(value = "assignedTasks")
| private Task assignedTask;
|
| /**
| * Stores a list of tasks that belong the groups the current user is member of and wait for an
| * assignment.
| */
| @DataModel
| private List<Task> groupTasks;
|
| /** Stores the currently selected assigned Task. */
| @DataModelSelection(value = "groupTasks")
| private Task groupTask;
|
| /**
| * Factory method to request the assigned tasks.
| */
| @Factory("assignedTasks")
| public void findAssignedTasks() {
| if (identity.isLoggedIn()) {
| assignedTasks = processEngine.getTaskService().findPersonalTasks(
| identity.getCredentials().getUsername());
| } else {
| assignedTasks = new ArrayList<Task>();
| }
| }
|
| /**
| * Factory method to request the group tasks.
| */
| @Factory("groupTasks")
| public void findGroupTasks() {
| if (identity.isLoggedIn()) {
| groupTasks = processEngine.getTaskService().findGroupTasks(
| identity.getCredentials().getUsername());
| } else {
| groupTasks = new ArrayList<Task>();
| }
| }
|
| public String assignGroupTask() {
| if (identity.isLoggedIn() && groupTask != null) {
| processEngine.getTaskService().assignTask(groupTask.getId(),
| identity.getCredentials().getUsername());
| return TASK_ASSIGNED;
| }
| return null;
| }
| }
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266991#4266991
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266991
16 years, 4 months
[jBPM Users] - Re: Can't get pooled task instance list with jbpm & seam - p
by achimh
Hi,
I just want to give the answer by myself, because I could fix the problem in the meantime and maybe someone is running into the same problems.
The main point for integrating jBPM 4 in Seam (2.2) seems to be that you have to ensure that jBPM 3 is not used in your application. Seam will load its jBPM3 (jbpm-jpdl.jar) component when there is a "<bpm:jbpm>" block in your components.xml - so remove it or at least uncomment it. As in jBPM3 you will have to add the jbpm.jar in your ear-root and register it as java-module in your application.xml like:
| <module>
| <ejb>jboss-seam.jar</ejb>
| </module>
|
| <module>
| <java>jbpm.jar</java>
| </module>
|
Besides these comfiguration issues you cannot use the seam-integrated jbpm-annotations. E.g. to start a process I use this:
| // this won't work: @createProcess(key="MyProcessName")
| public String createMyProcess() {
| ProcessEngine processEngine = new Configuration().buildProcessEngine();
| processEngine.getExecutionService().startProcessInstanceByKey("MyProcessName");
| return "startedMyProcess";
| }
|
Additionally I could not use the Actor class to inject the actor information, although I'm not sure if this might be my fault ;)
Instead I'm using the Seam Identity credentials as actor-id and wrote an own implementation for the IdentitySession interface which handels which groups a user is a member of etc. to determine assignment decisions. To let jBPM4 use this class I had to change my jbpm.cfg.xml to:
| <jbpm-configuration>
| <import resource="jbpm.default.cfg.xml" />
| <import resource="jbpm.tx.hibernate.cfg.xml" />
| <import resource="jbpm.jpdl.cfg.xml" />
| <transaction-context>
| <object class="mypackagename.jbpm.IdentitySessionImpl" />
| </transaction-context>
| <import resource="jbpm.businesscalendar.cfg.xml" />
|
| </jbpm-configuration>
That's my current knowledge about integrating jBPM 4 into Seam. Keep in mind that my application (and the integration) is not finished and there might be more issues to handle. But with these steps I'm able to run at least some simple business processes.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266990#4266990
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266990
16 years, 4 months
[jBPM Users] - mysql and JBPM Integration Problem
by Sunay
Hello All,
I got following stack trace when i migrated from hsql to mysql
java.lang.NullPointerException
at org.jboss.jms.server.ServerPeer.getPostOfficeInstance(ServerPeer.java:1382)
at org.jboss.jms.server.destination.DestinationServiceSupport.setMaxSizeForQueues(DestinationServiceSupport.java:273)
at org.jboss.jms.server.destination.DestinationServiceSupport.startService(DestinationServiceSupport.java:110)
at org.jboss.jms.server.destination.QueueService.startService(QueueService.java:65)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:376)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:269)
at org.jboss.mq.server.jmx.Queue.start(Queue.java:303)
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 org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
Any Suggestions?
Thanks
Sunay Shah
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266955#4266955
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266955
16 years, 4 months