[jBPM] - Re: getProcess in ProcessInstanceImpl throws a NullPointerException
by Marco Rietveld
Marco Rietveld [https://community.jboss.org/people/marco.rietveld] created the discussion
"Re: getProcess in ProcessInstanceImpl throws a NullPointerException"
To view the discussion, visit: https://community.jboss.org/message/806653#806653
--------------------------------------------------------------
Interesting.. well, if you can keep a secret ;D, the metadata that Shobhit was asking about is +actually available+. The jBPM parser parses and stores that information and it's available at (process instance) runtime. Actually, I'm pretty sure it's even available directly from the knowledge base. Of course, the minute we start trying hat metadata, the BPM engine is no longer a black box... I'll make a quick code example and post it on this thread in the next couple days.
But back to your process variable question: unfortunately, the only way to set process variables in a process is at the very beginning, with the following method:
{code}ksession.startProcess(String processId, Map<String, Object> parameters){code}
The String key in the parameters Map should match the name of the.. (searching brain for bpmn2 knowledge... ) property element in the process element. The property's itemSubjectDef should reference a itemDefintiion element defined with the correct data type ("java.lang.String", for example) above/outside the process element in your BPMN2.
At the moment, definining or adding a process variable (that you want to access outside of the engine) is only possible at process instance creation -- with the method described above. At least, as far as I know.. I'll check with some of the other dev's to make sure.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806653#806653]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - Re: getProcess in ProcessInstanceImpl throws a NullPointerException
by Marco Rietveld
Marco Rietveld [https://community.jboss.org/people/marco.rietveld] created the discussion
"Re: getProcess in ProcessInstanceImpl throws a NullPointerException"
To view the discussion, visit: https://community.jboss.org/message/806641#806641
--------------------------------------------------------------
There are one or two things you can do to keep the tx from closing -- but you don't want to go down that road. I've been there, and it just gets complexer and ends up in code that's harder to maintain.
(If you are really, really, really sure that you still want to do it after reading this, let me know and I can explain it.)
The main reason you don't want to fool around with tx's when working with jBPM is that jBPM is designed to have full control over transactions -- or in other words, when some of the drools/jbpm developers initially designed the persistence mechanism, they designed it only thinking about the use case where drools/jbpm had control over the tx's: later, some changes were made to make it possible for the users to do that, but the design of the core persistence mechanism (the SingleSessionCommandService) doesn't really play nice with that. With Drools/jBPM 6, we've expanded some of the possibilities, and hopefully we'll add even more in the coming year, but, in my very humble opinion, I don't think we're at a point yet where we can encourage users to take tx control away from the engine.
In short, once you take control of the tx with jBPM, you're getting into "hacking" territory and you'll be more and more on your own, so to speak.
So, having said that, I'm getting back to my original question: why do you want the node instance information? One of the anti-patterns that's emerged with BPM is "reaching into the engine": you're always better of treating the engine as a black box because it makes it easier to migrate to new versions of the engine (or other engines) in the long run. It's the same principle as webservices -- or even just information encapsulation.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806641#806641]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - Integrating jBPM5.4 with LDAP server
by Jeyalakshmi Ramachandran
Jeyalakshmi Ramachandran [https://community.jboss.org/people/jeyalakshmi.r] created the discussion
"Integrating jBPM5.4 with LDAP server"
To view the discussion, visit: https://community.jboss.org/message/806640#806640
--------------------------------------------------------------
Hi,
1. Created LDAP server with user and Role details using Apache Directory Studio.
2. Integrated jBPM with LDAP server (modified standalone.xml,web.xml of human task war and added jbpm.user.callback.properties).
3. Logged into jbpm console as admin and created a new process(evaluation process) with human task.
4. But when logged in as krisv, that human task is not reflecting in the personal task panel of the user(krisv). (this is because *task table in task DB is not getting updated* with the new task created).
I have attached the standalone.xml,web.xml of human task war , jbpm.user.callback.properties,LDAP user screenshot and server.log. Please provide me a solution.
Thanks,
Jeyalakshmi
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806640#806640]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - Re: getProcess in ProcessInstanceImpl throws a NullPointerException
by Marco Rietveld
Marco Rietveld [https://community.jboss.org/people/marco.rietveld] created the discussion
"Re: getProcess in ProcessInstanceImpl throws a NullPointerException"
To view the discussion, visit: https://community.jboss.org/message/806565#806565
--------------------------------------------------------------
h4. What's probably happening is that the code you're calling is happening outside of a transaction.
You've posted the code above, so you can see that the NPE is probably happening because the ProcessInstanceImpl.kruntime field is null.
The kruntime field in the ProcessInstanceImpl is set to null as soon as the transaction is closed. This has to do with making sure that jBPM doesn't cache old copies of processinstances.
So, in this case, when you call
wpi.getNodeInstances()
the transaction has already ended (it ended within the ksession.getProcessInstance() method).
May I ask why you want a list of NodeInstances? There may be other ways to get the information that you're looking for. Also, at the moment that you're looking for the node instances, there shouldn't be any or otherwise you're betting on a race condition.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806565#806565]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - Pass ksession to custom WorkItemHandler running in jBPM Console?
by Jim B
Jim B [https://community.jboss.org/people/jamesbeam] created the discussion
"Pass ksession to custom WorkItemHandler running in jBPM Console?"
To view the discussion, visit: https://community.jboss.org/message/806601#806601
--------------------------------------------------------------
I have a custom WorkItemHandler in which I am looking up all of the processes in the current session (and possibly starting new processes) e.g.: ksession.getProcessInstanceId() and ksession.startProcess(procName) respectively.
Initially, I passed in the ksession using the custom constructor for my WorkItemHandler that accepted a ksession value. Everything was great UNTIL I went to run the process inside of jBPM Console and realized that I don't have a way to call that constructor when I start the process from the Console.
As an alternative, I thought I would just insert the session into a variable in a script task and then pass that into my WorkItemHandler, but for the life of me I can't figure out how to get it working. I set up a process variable org.drools.runtime.StatefulKnowledgeSession and then set it in my script task with kcontext.getKnowledgeRuntime(). I see that I'm getting an org.drools.impl.StatefulKnowledgeSessionImpl and I am able to call kcontext.setVariable("ksession",myKnowlegeRuntime). However, I am using persistence and when I try to pass the variable into my WorkItemHandler (I successfully pass a few other variables) get an "IOException while storing..." I assume because it isn't serializable?
Can someone tell me how to inject (or obtain) the ksession in the WorkItemHandler WITHOUT relying on the custom constructor with ksession?
Alternatively, does anyone know how to pass a parameter (specifically, the ksession) to my workitemhandler running in the Console e.g. using the CustomWorkItemHandlers.conf?
Thanks for any insight!
-J
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806601#806601]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months