[JBoss jBPM] - do timers and multithreaded environment cause db deadlocking
by johndvm
I was wondering if there were any issues with using timers and multi-threaded execution.
I am using JBPM 3.2.6-SP1 and it seems like when I run two threads through my process workflow, I get a database deadlock.
It seems like 1 thread is holding open a transaction for the duration of the entire workflow, and has locked the JBPM_JOB table, and another thread starts and as it tries to transition between stages, it tries to delete from the JBPM_JOB table, and the entire thing gets deadlocked. It appears the problem is with trying to delete the timer at the same node.
org.jbpm.JbpmException: could not delete timers by name 'validate' for Token(/)
at org.jbpm.db.JobSession.deleteTimersByName(JobSession.java:216)
at org.jbpm.scheduler.db.DbSchedulerService.deleteTimersByName(DbSchedulerService.java:64)
at org.jbpm.scheduler.def.CancelTimerAction.execute(CancelTimerAction.java:46)
at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:281)
Is this something that is known, or have other people been able to use JBPM with timers in a multi-threaded environment?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240829#4240829
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4240829
16 years, 10 months
[JBoss jBPM] - Re: Indentityservice- Jbpm4
by nilspreusker
Hi guys, thanks for your feedback! Regarding the idea of modifying the hibernate mappings of the jBPM UserImpl, I did get it to work, but I agree with your point that it ties the two application domains too close together.
The reason I'm working with the trunk is that I'm using some spring integration code that was only added after the CR1 release. This also means that it will be rather difficult to test with the CR1 version, since the rest of my jBPM code won't work anymore. Whats more, according to the svn logs, there haven't been any significant changes to IdentitySessionBinding.java since the CR1 release (I'm assuming this class is responsible for wiring the classes from the configuration, please correct me if I'm wrong).
"kukeltje" wrote : If you want to help and make it fully plugable (which is not targeted at the 4.0 release) please discuss things in the dev forum.
I'd be happy to contribute, but to be honest, I'm a bit confused now. Shekharv's post suggest that the plugable configuration is already working, whereas the above quote indicates that it isn't even intended to be part of the 4.0 release. Maybe someone can shed some light on this.
Thanks! Nils
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240801#4240801
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4240801
16 years, 10 months
[JBoss jBPM] - Problem with examples in jBPM 4.0 CR1
by GertLeenders
After i deployed the examples i get the following error in the gwt console when i try to access the overview of the process definitions:
org.jbpm.api.JbpmException:
warning: unrecognized event listener: timer [line=11 column=36 ]
error: couldn't interpret the dom model: couldn't create object: couldn't load class org.jbpm.examples.timer.event.Escalate : org.jbpm.pvm.internal.wire.WireException: couldn't create object: couldn't load class org.jbpm.examples.timer.event.Escalate
error: couldn't interpret the dom model: couldn't create object: couldn't load class org.jbpm.examples.eventlistener.LogListener : org.jbpm.pvm.internal.wire.WireException: couldn't create object: couldn't load class org.jbpm.examples.eventlistener.LogListener
warning: unrecognized event listener: timer [line=11 column=57 ]
error: couldn't interpret the dom model: couldn't create object: couldn't load class org.jbpm.examples.timer.repeat.Escalate : org.jbpm.pvm.internal.wire.WireException: couldn't create object: couldn't load class org.jbpm.examples.timer.repeat.Escalate
xml validation error: cvc-complex-type.3.2.2: Attribute 'continue' is not allowed to appear in element 'on'. [line=10 column=43 ]: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'continue' is not allowed to appear in element 'on'.
xml validation error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'mail'. One of '{"http://jbpm.org/4.0/jpdl":swimlane, "http://jbpm.org/4.0/jpdl":on, "http://jbpm.org/4.0/jpdl":timer, "http://jbpm.org/4.0/jpdl":start, "http://jbpm.org/4.0/jpdl":end, "http://jbpm.org/4.0/jpdl":end-cancel, "http://jbpm.org/4.0/jpdl":end-error, "http://jbpm.org/4.0/jpdl":state, "http://jbpm.org/4.0/jpdl":decision, "http://jbpm.org/4.0/jpdl":fork, "http://jbpm.org/4.0/jpdl":join, "http://jbpm.org/4.0/jpdl":script, "http://jbpm.org/4.0/jpdl":hql, "http://jbpm.org/4.0/jpdl":sql, "http://jbpm.org/4.0/jpdl":java, "http://jbpm.org/4.0/jpdl":task, "http://jbpm.org/4.0/jpdl":sub-process}' is expected. [line=11 column=26 ]: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'mail'. One of '{"http://jbpm.org/4.0/jpdl":swimlane, "http://jbpm.org/4.0/jpdl":on, "http://jbpm.org/4.0/jpdl":timer, "http://jbpm.org/4.0/jpdl":start, "http://jbpm.org/4.0/jpdl":end, "http://jbpm.org/4.0/jpdl":end-cancel, "http://jbpm.org/4.0/jpdl":end-error, "http://jbpm.org/4.0/jpdl":state, "http://jbpm.org/4.0/jpdl":decision, "http://jbpm.org/4.0/jpdl":fork, "http://jbpm.org/4.0/jpdl":join, "http://jbpm.org/4.0/jpdl":script, "http://jbpm.org/4.0/jpdl":hql, "http://jbpm.org/4.0/jpdl":sql, "http://jbpm.org/4.0/jpdl":java, "http://jbpm.org/4.0/jpdl":task, "http://jbpm.org/4.0/jpdl":sub-process}' is expected.
error: mail template not found: rectify-template [line=11 column=26 ]
xml validation error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'custom'. One of '{"http://jbpm.org/4.0/jpdl":swimlane, "http://jbpm.org/4.0/jpdl":on, "http://jbpm.org/4.0/jpdl":timer, "http://jbpm.org/4.0/jpdl":start, "http://jbpm.org/4.0/jpdl":end, "http://jbpm.org/4.0/jpdl":end-cancel, "http://jbpm.org/4.0/jpdl":end-error, "http://jbpm.org/4.0/jpdl":state, "http://jbpm.org/4.0/jpdl":decision, "http://jbpm.org/4.0/jpdl":fork, "http://jbpm.org/4.0/jpdl":join, "http://jbpm.org/4.0/jpdl":script, "http://jbpm.org/4.0/jpdl":hql, "http://jbpm.org/4.0/jpdl":sql, "http://jbpm.org/4.0/jpdl":java, "http://jbpm.org/4.0/jpdl":task, "http://jbpm.org/4.0/jpdl":sub-process}' is expected. [line=11 column=26 ]: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'custom'. One of '{"http://jbpm.org/4.0/jpdl":swimlane, "http://jbpm.org/4.0/jpdl":on, "http://jbpm.org/4.0/jpdl":timer, "http://jbpm.org/4.0/jpdl":start, "http://jbpm.org/4.0/jpdl":end, "http://jbpm.org/4.0/jpdl":end-cancel, "http://jbpm.org/4.0/jpdl":end-error, "http://jbpm.org/4.0/jpdl":state, "http://jbpm.org/4.0/jpdl":decision, "http://jbpm.org/4.0/jpdl":fork, "http://jbpm.org/4.0/jpdl":join, "http://jbpm.org/4.0/jpdl":script, "http://jbpm.org/4.0/jpdl":hql, "http://jbpm.org/4.0/jpdl":sql, "http://jbpm.org/4.0/jpdl":java, "http://jbpm.org/4.0/jpdl":task, "http://jbpm.org/4.0/jpdl":sub-process}' is expected.
xml validation error: cvc-complex-type.3.2.2: Attribute 'continue' is not allowed to appear in element 'java'. [line=13 column=24 ]: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'continue' is not allowed to appear in element 'java'.
xml validation error: cvc-complex-type.3.2.2: Attribute 'continue' is not allowed to appear in element 'java'. [line=21 column=25 ]: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'continue' is not allowed to appear in element 'java'.
org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:169)
org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:142)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
org.jbpm.pvm.internal.repository.DeploymentImpl_$$_javassist_21.getJbpmException(DeploymentImpl_$$_javassist_21.java)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:62)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.getObject(RepositorySessionImpl.java:133)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:80)
org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java:72)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.list(ProcessDefinitionQueryImpl.java:147)
org.jbpm.jpdl.internal.repository.JpdlDeployer.checkKey(JpdlDeployer.java:108)
org.jbpm.jpdl.internal.repository.JpdlDeployer.deploy(JpdlDeployer.java:79)
org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:36)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:59)
org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor.executeCmdInNewJtaTx(JtaTransactionInterceptor.java:122)
org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:70)
org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:90)
org.apache.jsp.index_jsp._jspService(index_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
org.jbpm.api.JbpmException
org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:165)
org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:142)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
org.jbpm.pvm.internal.repository.DeploymentImpl_$$_javassist_21.getJbpmException(DeploymentImpl_$$_javassist_21.java)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:62)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.getObject(RepositorySessionImpl.java:133)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:80)
org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java:72)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.list(ProcessDefinitionQueryImpl.java:147)
org.jbpm.jpdl.internal.repository.JpdlDeployer.checkKey(JpdlDeployer.java:108)
org.jbpm.jpdl.internal.repository.JpdlDeployer.deploy(JpdlDeployer.java:79)
org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:36)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:59)
org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor.executeCmdInNewJtaTx(JtaTransactionInterceptor.java:122)
org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:70)
org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:90)
org.apache.jsp.index_jsp._jspService(index_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'continue' is not allowed to appear in element 'java'.
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
org.apache.xerces.impl.xs.XMLSchemaValidator.processAttributes(Unknown Source)
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
org.jbpm.pvm.internal.xml.Parser.buildDom(Parser.java:451)
org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:387)
org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:157)
org.jbpm.jpdl.internal.repository.JpdlDeployer.deploy(JpdlDeployer.java:58)
org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:36)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:59)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.getObject(RepositorySessionImpl.java:133)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:80)
org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java:72)
org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.list(ProcessDefinitionQueryImpl.java:147)
org.jbpm.jpdl.internal.repository.JpdlDeployer.checkKey(JpdlDeployer.java:108)
org.jbpm.jpdl.internal.repository.JpdlDeployer.deploy(JpdlDeployer.java:79)
org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:36)
org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:59)
org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor.executeCmdInNewJtaTx(JtaTransactionInterceptor.java:122)
org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:70)
org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:90)
org.apache.jsp.index_jsp._jspService(index_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Any idea someone?
It would also help me if someone could tell me how i can undeploy the examples.
Kind regards,
Gert
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240794#4240794
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4240794
16 years, 10 months
[JBoss jBPM] - Re: WARN [ProxyWarnLog] Narrowing proxy to class org.jbpm.g
by vnm
Hi Ronald,
Sorry to send you improper code..As I was in bit hurry to send you I just skipped to resolve compilation issues,below is my modified code..Before you run it I request you to put my processdefintion.xml in src for testing,herein with I am also sending you my xml..
And another thing I want to mention is in my code import org.jbpm.db.AbstractDbTestCase; this import couldnt be resolved as this class in not in my jbpm-jpdl.jar...I am using jbpm version 3.2.3..And the same class is used in java file for which you sent me the link
code of class
| package org.jbpm.job.executor;
|
| import java.io.Serializable;
| import java.util.ArrayList;
| import java.util.Collections;
| import java.util.HashSet;
| import java.util.List;
| import java.util.Set;
| import java.util.TreeSet;
|
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
| import org.jbpm.JbpmConfiguration;
| import org.jbpm.JbpmContext;
| import org.jbpm.context.exe.ContextInstance;
| import org.jbpm.db.AbstractDbTestCase;
| import org.jbpm.graph.def.Action;
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.exe.ProcessInstance;
| import org.jbpm.graph.exe.Token;
| import org.jbpm.graph.node.DecisionHandler;
|
| public class JobExecutorDbTest extends AbstractDbTestCase {
| final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance("jbpm.cfg.xml");
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| static final int nbrOfConcurrentProcessExecutions = 20;
| static final int timeout = 60000;
| final Log logger = LogFactory.getLog(getClass());
| static Set<String> collectedResults = Collections.synchronizedSet(new TreeSet<String>());
| static List<Long> allocatedProcessIds = Collections.synchronizedList(new ArrayList<Long>());
|
| @Override
| protected void setUp() throws Exception {
| super.setUp();
| getJbpmConfiguration().getJobExecutor().setNbrOfThreads(4);
| }
|
| @Override
| protected void tearDown() throws Exception {
| getJbpmConfiguration().getJobExecutor().setNbrOfThreads(1);
| super.tearDown();
| }
|
| public void testJobExecutor() {
| deployProcessDefinition();
| try {
| ServiceVO serviceVO = new ServiceVO();
| serviceVO.setProcessDefinitionName("SuperStateSample");
| initiateProcess(serviceVO);
| processJobs(timeout);
| // assertEquals(getExpectedResults(), collectedResults);
| }
| finally {
|
| }
| }
|
| void deployProcessDefinition() {
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("processdefinition.xml");
| jbpmContext.deployProcessDefinition(processDefinition);
|
| }
|
| void initiateProcess(ServiceVO serviceVO) {
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| String processName = serviceVO.getProcessDefinitionName();
| logger.info("processName==="+processName);
| ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(processName);
| logger.info("--------------after getting processInstance");
| long processInstanceId = processInstance.getId();
|
| Token token = processInstance.getRootToken();
| logger.info("--------------after getting token");
| ContextInstance contextInstance = processInstance.getContextInstance();
| logger.info("--------------after getting contextInstance");
| contextInstance.setVariable("serviceVO", serviceVO);
|
| /*if(processVariables!=null){
| Set keySet = processVariables.keySet();
| Iterator keyIterator = keySet.iterator();
| String key = null;
| Object obj = null;
| while(keyIterator.hasNext()){
|
| key = (String)keyIterator.next();
| obj = processVariables.get(key);
|
| contextInstance.setVariable(key,obj);
|
| }
| }*/
| processInstance.signal();
| logger.info("---------after processInstance singal");
| logger.info("--------------after signal");
|
| logger.info("--------------after saving token");
| jbpmContext.save(processInstance);
| logger.info("--------------after saving processInstance");
| logger.info("root token======="+token.getId());
|
|
|
| jbpmContext.close();
| }
| }
|
| //start
| class ServiceVO implements Serializable{
|
|
|
| private String processDefinitionName;
|
|
| public String getProcessDefinitionName() {
| return processDefinitionName;
| }
|
| public void setProcessDefinitionName(String processDefinitionName) {
| this.processDefinitionName = processDefinitionName;
| }
|
|
|
| }
| //end
|
|
| //start
| class ActionHandler1 implements ActionHandler{
|
| public void execute(ExecutionContext executionContext) throws Exception {
| System.out.println("===========>>>>in action handler 1 >>>>>>>>>");
|
| }
| }
| //end
|
| //start
| class DecisionHandler1 implements DecisionHandler {
| public String decide(ExecutionContext arg0) throws Exception {
| // TODO Auto-generated method stub
| System.out.println("--in handler1-");
| return "node3";
| }
| }
| //end
|
| //start
| class DecisionHandler2 implements DecisionHandler {
| public String decide(ExecutionContext arg0) throws Exception {
| // TODO Auto-generated method stub
| System.out.println("--in handler2-");
| return "node4";
| }
| }
|
| //end
code for processdefinition.xml
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="SuperStateSample">
|
|
| <start-state name="start-state1">
| <transition to="node1"></transition>
| </start-state>
|
|
| <node name="node1">
| <event type="node-enter">
| <action name="action1" class="testFolder.ActionHandler1"></action>
| </event>
| <transition to="super-state1"></transition>
| </node>
|
| <super-state name="super-state1">
| <node name="node3">
| <event type="node-enter">
| <action name="action3" class="testFolder.ActionHandler3"></action>
| </event>
| <transition to="join1"></transition>
| </node>
| <node name="node4">
| <event type="node-enter">
| <action name="action4" class="testFolder.ActionHandler4"></action>
| </event>
| <transition to="join1"></transition>
| </node>
| <decision name="decision1">
| <handler class="testFolder.DecisionHandler1"></handler>
| <transition to="node3" name="node3"></transition>
| <transition to="join1" name="to join1"></transition>
| </decision>
| <decision name="decision2">
| <handler class="testFolder.DecisionHandler2"></handler>
| <transition to="node4" name="node4"></transition>
| <transition to="join1" name="to join1"></transition>
| </decision>
| <join name="join1">
| <transition to="node5"></transition>
| </join>
| <fork name="fork1">
| <transition to="decision1"></transition>
| <transition to="decision2" name="to decision2"></transition>
| </fork>
| <node name="node5">
| <event type="node-enter">
| <action class="testFolder.ActionHandler5"></action>
| </event>
| </node>
| <node name="node2">
| <event type="node-enter">
| <action name="action2" class="testFolder.ActionHandler2"></action>
| </event>
| <transition to="fork1"></transition>
| </node>
| <transition to="end-state1"></transition>
| </super-state>
|
|
| <end-state name="end-state1"></end-state>
|
|
| </process-definition>
jbpm.cfg.xml
| <jbpm-configuration>
|
| <!--
| The default configurations can be found in org/jbpm/default.jbpm.cfg.xml
| Those configurations can be overwritten by putting this file called
| jbpm.cfg.xml on the root of the classpath and put in the customized values.
| -->
| <jbpm-context>
| <service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />
| <service name='message' factory='org.jbpm.msg.db.DbMessageServiceFactory' />
| <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
| <!--<service name='scheduler' factory='org.jbpm.scheduler.db.DbSchedulerServiceFactory' />-->
| <service name='logging' factory='org.jbpm.logging.db.DbLoggingServiceFactory' />
| <service name='authentication' factory='org.jbpm.security.authentication.DefaultAuthenticationServiceFactory' />
| </jbpm-context>
|
| <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar-->
| <string name='resource.hibernate.cfg.xml' value='hibernate.cfg.xml' />
| <!-- <string name='resource.hibernate.properties' value='hibernate.properties' /> -->
| <string name='resource.business.calendar' value='org/jbpm/calendar/jbpm.business.calendar.properties' />
| <string name='resource.default.modules' value='org/jbpm/graph/def/jbpm.default.modules.properties' />
| <string name='resource.converter' value='org/jbpm/db/hibernate/jbpm.converter.properties' />
| <string name='resource.action.types' value='org/jbpm/graph/action/action.types.xml' />
| <string name='resource.node.types' value='org/jbpm/graph/node/node.types.xml' />
| <string name='resource.parsers' value='org/jbpm/jpdl/par/jbpm.parsers.xml' />
| <string name='resource.varmapping' value='org/jbpm/context/exe/jbpm.varmapping.xml' />
|
| <int name='jbpm.byte.block.size' value="1024" singleton="true" />
| <bean name='jbpm.task.instance.factory' class='org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl' singleton='true' />
| <bean name='jbpm.variable.resolver' class='org.jbpm.jpdl.el.impl.JbpmVariableResolver' singleton='true' />
|
| </jbpm-configuration>
Thanks and Regards
vnm
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240757#4240757
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4240757
16 years, 10 months
[JBoss jBPM] - Re: WARN [ProxyWarnLog] Narrowing proxy to class org.jbpm.g
by vnm
Hi Ronald,
Sending you a single java file that contains all things used in my process..
package org.jbpm.job.executor;
|
| import java.util.ArrayList;
| import java.util.Collections;
| import java.util.HashSet;
| import java.util.List;
| import java.util.Set;
| import java.util.TreeSet;
|
| import org.jbpm.db.AbstractDbTestCase;
| import org.jbpm.graph.def.Action;
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.exe.ProcessInstance;
|
| public class JobExecutorDbTest extends AbstractDbTestCase {
|
| static final int nbrOfConcurrentProcessExecutions = 20;
| static final int timeout = 60000;
|
| static Set<String> collectedResults = Collections.synchronizedSet(new TreeSet<String>());
| static List<Long> allocatedProcessIds = Collections.synchronizedList(new ArrayList<Long>());
|
| @Override
| protected void setUp() throws Exception {
| super.setUp();
| getJbpmConfiguration().getJobExecutor().setNbrOfThreads(4);
| }
|
| @Override
| protected void tearDown() throws Exception {
| getJbpmConfiguration().getJobExecutor().setNbrOfThreads(1);
| super.tearDown();
| }
|
| public void testJobExecutor() {
| deployProcessDefinition();
| try {
| ServiceVO serviceVO = new ServiceVO();
| serviceVO.setProcessDefinitionName("SuperStateSample");
| initiateProcess(serviceVO);
| processJobs(timeout);
| // assertEquals(getExpectedResults(), collectedResults);
| }
| finally {
|
| }
| }
|
| void deployProcessDefinition() {
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("
| <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="SuperStateSample">
|
|
| <start-state name="start-state1">
| <transition to="node1"></transition>
| </start-state>
|
|
| <node name="node1">
| <event type="node-enter">
| <action name="action1" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="super-state1"></transition>
| </node>
|
| <super-state name="super-state1">
| <node name="node3">
| <event type="node-enter">
| <action name="action3" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="join1"></transition>
| </node>
| <node name="node4">
| <event type="node-enter">
| <action name="action4" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="join1"></transition>
| </node>
| <decision name="decision1">
| <handler class="DecisionHandler1.class.getName()"></handler>
| <transition to="node3" name="node3"></transition>
| <transition to="join1" name="to join1"></transition>
| </decision>
| <decision name="decision2">
| <handler class="DecisionHandler2.class.getName()"></handler>
| <transition to="node4" name="node4"></transition>
| <transition to="join1" name="to join1"></transition>
| </decision>
| <join name="join1">
| <transition to="node5"></transition>
| </join>
| <fork name="fork1">
| <transition to="decision1"></transition>
| <transition to="decision2" name="to decision2"></transition>
| </fork>
| <node name="node5">
| <event type="node-enter">
| <action class="ActionHandler1.class.getName()"></action>
| </event>
| </node>
| <node name="node2">
| <event type="node-enter">
| <action name="action2" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="fork1"></transition>
| </node>
| <transition to="end-state1"></transition>
| </super-state>
|
|
| <end-state name="end-state1"></end-state>
|
|
| </process-definition>");
| jbpmContext.deployProcessDefinition(processDefinition);
|
| }
|
| void initiateProcess(ServiceVO serviceVO) {
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| String processName = serviceVO.getProcessDefinitionName();
| logger.info("processName==="+processName);
| ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(processName);
| logger.info("--------------after getting processInstance");
| long processInstanceId = processInstance.getId();
|
| Token token = processInstance.getRootToken();
| logger.info("--------------after getting token");
| ContextInstance contextInstance = processInstance.getContextInstance();
| logger.info("--------------after getting contextInstance");
| contextInstance.setVariable("serviceVO", serviceVO);
|
| /*if(processVariables!=null){
| Set keySet = processVariables.keySet();
| Iterator keyIterator = keySet.iterator();
| String key = null;
| Object obj = null;
| while(keyIterator.hasNext()){
|
| key = (String)keyIterator.next();
| obj = processVariables.get(key);
|
| contextInstance.setVariable(key,obj);
|
| }
| }*/
| processInstance.signal();
| logger.info("---------after processInstance singal");
| logger.info("--------------after signal");
|
| logger.info("--------------after saving token");
| jbpmContext.save(processInstance);
| logger.info("--------------after saving processInstance");
| logger.info("root token======="+token.getId());
|
|
|
| jbpmContext.close();
| }
| }
|
| //start
| class ServiceVO implements Serializable{
|
|
|
| private String processDefinitionName;
|
|
| public String getProcessDefinitionName() {
| return processDefinitionName;
| }
|
| public void setProcessDefinitionName(String processDefinitionName) {
| this.processDefinitionName = processDefinitionName;
| }
|
|
|
| }
| //end
|
|
| //start
| class ActionHandler1 implements ActionHandler{
|
| public void execute(ExecutionContext executionContext) throws Exception {
| System.out.println("===========>>>>in action handler 1 >>>>>>>>>");
|
| }
| //end
|
| //start
| class DecisionHandler1 implements DecisionHandler {
| public String decide(ExecutionContext arg0) throws Exception {
| // TODO Auto-generated method stub
| System.out.println("--in handler1-");
| return "node3";
| }
| //end
|
| //start
| class DecisionHandler2 implements DecisionHandler {
| public String decide(ExecutionContext arg0) throws Exception {
| // TODO Auto-generated method stub
| System.out.println("--in handler2-");
| return "node4";
| }
|
| }
| //end
Thanks
vnm
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240732#4240732
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4240732
16 years, 10 months