[JBoss jBPM] - Re: JbpmContext usage & best practices
by apdo
We are using jbpm with EJB3. we use jbpm beind SLSB
Here is a solution that we have implemented.
We have implemented an Interceptor (using jboss AOP) that identify when it exit from the latest layer of a SLSB (exit from the business layer). When the aspect identify that the execution path is going to exit from the business layer it close the ejbcontext.
In the Interceptor, we identify when we exit from the first called SLSB (exit from the business layer) by using a counter in the Interceptor. the counter is incremented when entering in the aspect and in the finaly block, if the counter is 0 the jbpmcontext is closed if it has been opened during the transaction.
It will have been easier to register a listener to the jboss transaction but I didn`t find anyway to do it. Is there a way to doing it?
An Phong Do
www.solabs.com
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4213004#4213004
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4213004
15 years, 9 months
[JBoss jBPM] - pvm_subprocess_problems
by galanfish
hi, can anyone help me:
there is a testcase 'org.jbpm.test.activities.SubProcessTest' in module 'test-pojo' which is run in object-mode.
and so i try to write a subprocess testcase running in persistent-mode. i have been trying but i can not make it... exception comes out:
10:37:11,250 SEV | [LazyInitializationException] could not initialize proxy - no Session
| org.hibernate.LazyInitializationException: could not initialize proxy - no Session
| at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
| at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
| at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
| at org.jbpm.pvm.internal.model.ActivityImpl$$EnhancerByCGLIB$$fa091528.getParentActivity(<generated>)
| at org.jbpm.pvm.internal.model.ExecutionImpl.initializeScopes(ExecutionImpl.java:210)
| at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:193)
| at org.jbpm.pvm.internal.model.ExecutionImpl.beginSubProcessInstance(ExecutionImpl.java:882)
| at name.galanfish.test.super_sub_process.cmd.StartSubProcessCmd.execute(StartSubProcessCmd.java:33)
| at name.galanfish.test.super_sub_process.cmd.StartSubProcessCmd.execute(StartSubProcessCmd.java:1)
| at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
| at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
| at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
| at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:52)
| at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.beginSubProcess(ExecutionServiceImpl.java:84)
| at name.galanfish.test.super_sub_process.SubProcess.execute(SubProcess.java:36)
| at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:57)
| at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:587)
| at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:560)
| at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:384)
| at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:62)
| at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:1)
| at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
| at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
| at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
| at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:52)
| at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:121)
| at name.galanfish.test.super_sub_process.SuperSubProcessTest.testSimpleSuperSubProcess(SuperSubProcessTest.java:38)
| 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 junit.framework.TestCase.runTest(TestCase.java:164)
| at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:81)
| 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:460)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
the source code as follow:
public class SuperSubProcessTest extends EnvironmentFactoryTestCase {
|
| private JbpmConfiguration factory;
| private ProcessServiceImpl processService;
| private ExecutionService executionService;
|
|
| @Override
| protected void setUp() throws Exception {
| super.setUp();
| factory = (JbpmConfiguration) getEnvironmentFactory();
| processService = (ProcessServiceImpl) factory.getProcessService();
| executionService = factory.getExecutionService();
| }
|
| public void testSimpleSuperSubProcess(){
| createAndDeploySimpleSuperSubProcess();
| executionService.startProcessInstanceById("super2:1", "superrequest8");
| executionService.signalExecutionById("super2/superrequest8", "to_one");
| }
|
| private void createAndDeploySimpleSuperSubProcess(){
| ClientProcessDefinition superProcess = ProcessDefinitionBuilder.startProcess("super2")
| .startActivity("start", WaitState.class)
| .initial()
| .transition("one", "to_one")
| .endActivity()
|
| .startActivity("one", AutomaticActivity.class)
| .transition("sub", "to_sub")
| .endActivity()
|
| .startActivity("sub", SubProcess.class)
| .transition("end", "to_end")
| .endActivity()
|
| .startActivity("end", AutomaticActivity.class)
| .endActivity()
| .endProcess();
|
| ClientProcessDefinition subProcess = ProcessDefinitionBuilder.startProcess("sub2")
| .startActivity("start", AutomaticActivity.class)
| .initial()
| .transition("end", "to_end")
| .endActivity()
|
| .startActivity("end", EndState.class)
| .endActivity()
| .endProcess();
|
| deployProcess(superProcess);
| deployProcess(subProcess);
| }
|
| private void deployProcess(ProcessDefinition process){
| Deployment deployment = processService.createDeployment();
| deployment.addObject("process", process);
| processService.deploy(deployment);
| }
| }
|
| public class SubProcess implements ExternalActivityBehaviour{
|
| private static final long serialVersionUID = 1L;
|
| public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception {
|
| }
|
| public void execute(ActivityExecution execution) throws Exception {
| ProcessService processService = Environment.getFromCurrent(ProcessService.class);
| ClientProcessDefinition subProcess = (ClientProcessDefinition)processService.findLatestProcessDefinitionByKey("sub2"); // hard code
|
| ExecutionService exeService = Environment.getFromCurrent(ExecutionService.class);
| // i add method 'beginSubProcess' in ExecutionService which is to execute the command 'StartSubProcessCmd'(source code as follow)
| Execution subExecution = exeService.beginSubProcess(execution, subProcess, "subrequest1"); // hard code
| if(!subExecution.isEnded()){
| execution.waitForSignal();
| }
| }
| }
|
| public class StartSubProcessCmd extends AbstractCommand<Execution>{
|
| private static final long serialVersionUID = 1L;
|
| private ActivityExecution parentExecution;
| private ProcessDefinition subProcess;
| private String key;
| public StartSubProcessCmd(Execution parentExecution, ProcessDefinition subProcess, String key){
| this.parentExecution = (ActivityExecution)parentExecution;
| this.subProcess = subProcess;
| this.key = key;
| }
|
| public Execution execute(Environment environment) throws Exception {
| ClientExecution subExecution = parentExecution.beginSubProcessInstance((ClientProcessDefinition) subProcess, key);
| return subExecution;
| }
| }
appreciate!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212929#4212929
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212929
15 years, 9 months
[JBoss jBPM] - Assignment Handler gets wrong ProcessInstance ID
by wurzelbutz
Hello (:
I'm using an Assignment Handler to assign my tasks to users and there is a strange issue:
public void assign(Assignable arg0, ExecutionContext arg1) throws Exception {
| System.out.println("AH-PID:"+arg1.getProcessInstance().getId());
| System.out.println("AH-TN-ID:"+arg1.getTaskInstance().getTask().getTaskNode().getId());
| ... read target user from DB and assign ..
| }
|
Here is what i do:
1.) Start a new process with >1 TaskNodes(each containing at least 1 task). The processInstance has ID 16.
Assignment Handler is called.
AH-PID=16 --> OK
AH-TN-ID=3424 --> OK
2.) Start first tasknode
3.) End first tasknode. TN is ended as expected.
Assignment handler is called for the next TN.
AH-TN-ID=3425 --> OK
AH-PID=17 --> Why? I dont have a processInstance with ID 17. i did some debugging and noticed that the startDate of ProcessInstance 17 is the same as the current date.
What is the correct way to read the current processInstance inside the Assignment Handler?
br Hugo
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212888#4212888
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212888
15 years, 9 months
[JBoss jBPM] - Re: GRAVE: Error Rendering View[/sa/procins.xhtml]
by rodosa
the_fredo thank you for your response. I've a look to the topic but I didn't be able to fix the problem.
I've replaced jsf-facelets library for jsf-facelets-1.1.15.B1.jar and I changed .xhtml files. I made changes like this:
Changed
| <ga:parameter name="fn" target="#{task_filter_notstarted}" default="true"/>
| <ga:parameter name="fr" target="#{task_filter_running}" default="true"/>
| <ga:parameter name="fs" target="#{task_filter_suspended}" default="true"/>
| <ga:parameter name="fe" target="#{task_filter_ended}" default="false"/>
|
To
|
| <ga:parameter name="fn" target="#{task_filter_notstarted}" default="${true}">
| <f:converter converterId="javax.faces.Boolean"/>
| </ga:parameter>
| <ga:parameter name="fr" target="#{task_filter_running}" default="${true}">
| <f:converter converterId="javax.faces.Boolean"/>
| </ga:parameter>
| <ga:parameter name="fs" target="#{task_filter_suspended}" default="${true}">
| <f:converter converterId="javax.faces.Boolean"/>
| </ga:parameter>
| <ga:parameter name="fe" target="#{filter_ended}" default="${false}">
| <f:converter converterId="javax.faces.Boolean"/>
| </ga:parameter>
|
And changed
| <h:selectBooleanCheckbox id="task_notstarted_i" value="#{task_filter_notstarted}"/>
|
To
| <h:selectBooleanCheckbox id="task_notstarted_i" value="#{task_filter_notstarted == 'true'}"/>
|
What am I doing bad??
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212711#4212711
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212711
15 years, 9 months