[jBPM] - How to read return-variable from bpmn files to java file?
by mutou wang
mutou wang [https://community.jboss.org/people/mutou] created the discussion
"How to read return-variable from bpmn files to java file?"
To view the discussion, visit: https://community.jboss.org/message/742296#742296
--------------------------------------------------------------
Hello!
I hava some problems here.
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
Map<String,Object>paras=new HashMap<String,Object>();
paras.put("i", new Integer("1"));
paras.put("ret", new Integer("10"));
// start a new process instance
ProcessInstance instance=(ProcessInstance) ksession.startProcess("org.jbpm.sample.hello",paras);
System.out.println(paras.get("ret"));
I hava two parameters here, "i' and "ret", "i" is the input and i want "ret" to be the output. Furthmore, the script in the bpmn file
will process the sentence:
ret = 2 * i;
so "ret" will be 2. However, in my java file after "System.out.println(paras.get("ret"));" was processed, it output 10.
I am confused that how to read the return value "ret" from the bpmn file and in my work, how to print the correct Integer 2 rather than 10???
should I utilize kcontext ? But kcontext is predefined in script, not in java file. How to define kcontext and utilize it to get varible???
Thanks !!!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/742296#742296]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[jBPM] - IllegalArgumentException: Unable to instantiate service for Class 'org.drools.compiler.BPMN2ProcessProvider'
by mutou wang
mutou wang [https://community.jboss.org/people/mutou] created the discussion
"IllegalArgumentException: Unable to instantiate service for Class 'org.drools.compiler.BPMN2ProcessProvider'"
To view the discussion, visit: https://community.jboss.org/message/737590#737590
--------------------------------------------------------------
Hello, everyone!
When I was running the java sentences:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newFileResource(filename), ResourceType.BPMN2);
the second line throws a IIIlegalArgumentException like this:
java.lang.IllegalArgumentException: Unable to instantiate service for Class 'org.drools.compiler.BPMN2ProcessProvider' at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:161)
at org.drools.compiler.BPMN2ProcessFactory.loadProvider(BPMN2ProcessFactory.java:29)
at org.drools.compiler.BPMN2ProcessFactory.getBPMN2ProcessProvider(BPMN2ProcessFactory.java:21)
at org.drools.compiler.BPMN2ProcessFactory.configurePackageBuilder(BPMN2ProcessFactory.java:12)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:607)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)
at org.thgrid.robinia.executor.impl.JbpmInstance.readKnowledgeBase(JbpmInstance.java:85)
at org.thgrid.robinia.executor.impl.JbpmInstance.doIt(JbpmInstance.java:64)
at org.thgrid.robinia.executor.impl.AbstractInstance.run(AbstractInstance.java:154)
at org.thgrid.robinia.event.CallbackEventHandler.handle(CallbackEventHandler.java:11)
at org.thgrid.robinia.event.EventProcessThread.handleEvent(EventCenter.java:67)
at org.thgrid.robinia.event.EventProcessThread.run(EventCenter.java:45)
Caused by: java.lang.IllegalArgumentException: Unable to instantiate 'org.jbpm.bpmn2.BPMN2ProcessProviderImpl' at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:210)
at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.call(ServiceRegistryImpl.java:202)
at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:159)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.jbpm.bpmn2.BPMN2ProcessProviderImpl at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source)
at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:207) ... 13 more
I debuged this program for days and search the Internet for solutions, but in vain.
How could this Exceptions happen?
And What should I do to solve this problem??
Thank you!!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/737590#737590]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[jBPM] - Re: Scalable use of Timer Events
by Maciej Swiderski
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion
"Re: Scalable use of Timer Events"
To view the discussion, visit: https://community.jboss.org/message/741662#741662
--------------------------------------------------------------
Be default timer service is created with thread pool of size one so that is why you observe this behavior. There are two things you could do:
1. use separate session as timer service is per session
2. increase number of threads in the pool by registering timer service on your own
If you go for option two, here are some hints:
- if using persistence then make use of JpaJDKTimerService
- if not use JDKTimerService
both have constructors that accepts integer that will be used as size of the pool.
To set this you should use session configuration and set class name for property *drools.timerService*. As you can see it requires class name and not the instance itself so there is no easy way to set the desired pool size as that uses default constructor. One way to go is to simply extend one of the timer service implementation and make sure that your custom class default constructor will set the pool size to higher value.
HTH
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/741662#741662]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[jBPM] - Problem with subprocesses embedded in multi-instance nodes
by Martin Landua
Martin Landua [https://community.jboss.org/people/martin.landua] created the discussion
"Problem with subprocesses embedded in multi-instance nodes"
To view the discussion, visit: https://community.jboss.org/message/741681#741681
--------------------------------------------------------------
Hi all,
we are struggling with a problem sub processes from within a multi-instance node if the sub processes contain a timer or a signal event, so when the execution flow is interrupted in the sub process. The problem is that the main process fails to continue after the second multi-instance node.
We would very much appreciate your feedback.
We are using jBPM version 5.3.0.Final, embedded in JBoss 7.1.1. We have configured persistence against a MySql 5.5 database.
Despite of the actual implementation of our process the following extracted sample pretty much shows what our problem is.
https://community.jboss.org/servlet/JiveServlet/showImage/2-741681-18747/... https://community.jboss.org/servlet/JiveServlet/downloadImage/2-741681-18...
After a few days of analysis we feel that following happens:
* We start the process as usual using startProcess, providing an array with two strings "A" and "B" which in essence launches two sub processes from the multi-instance node.
* Everything is fine with the first multi-instance node, it creates the sub processes, adds two more rows to processinstanceinfo (in addition to the one of the main process) and adds another two rows to eventtypes with the fixed content "processInstanceCompleted:xxx" where xxx is the process id of the respective sub process.
* Within the sub processes, the timer event stops the process execution, persisting everything to the database and waits until the timer fires again.
* Once the timer has fired, the two sub processes are signalled and due to the fact that there is a listener to the "processInstanceCompleted" event in the main process, the main process will get evidence once all sub processes have completed, and can continue to execute.
* Now the main process again creates two sub processes and again it will register the two "processInstanceCompleted" created by its child sub processes.
* But - and here is the problem from my point of view - the sub process does not get updated or otherwise persisted once the sub processes run into the timer events.
* As a result, those "processInstanceCompleted" events will not show up in the database and consequently, the main process will never be informed once the sub processes are terminating.
* The last step in the process can never be reached.
>From what I understand, the problem can occur ONLY in cases when there is a second sub process/multi-instance component and within the sub process there is a break from a timer node or a signal event node.
We are launching the main process from a stateless session bean in response to a message grabbed from a JMS-like queuing system. I am pretty sure that we do not have a problem with persistence in general.
I have attached the skeleton of the project.
Any comment or idea is highly appreciated.
Thanks in advance,
Martin
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/741681#741681]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years