[jboss-user] [jBPM] - How to get parameters in script action

martin steve do-not-reply at jboss.com
Fri Jan 18 22:57:46 EST 2013


martin steve [https://community.jboss.org/people/martin_2013] created the discussion

"How to get parameters in script action"

To view the discussion, visit: https://community.jboss.org/message/792880#792880

--------------------------------------------------------------
Hello everybody.I have a question, then need your help.

I start a process by session and set a map of parameters.The name of a parameter is "person". As follows:

KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
 kBuilder.add(ResourceFactory.newClassPathResource("hello.bpmn"), 
                ResourceType.BPMN2);
KnowledgeBase kBase = kBuilder.newKnowledgeBase();
StatefulKnowledgeSession kSession = kBase.newStatefulKnowledgeSession();
Map<String, Object> params = new HashMap<String, Object>();    
Person person = new Person();
person.setName("martin");
 params.put("person", person);
ProcessInstance pInstance = kSession.startProcess("com.sample.hello", params);

then I think print the name of person in a script action.Code as follows:

System.out.println(person.getName());

I run my codes and then get a exception:

[main] ERROR builder.impl.KnowledgeBuilderImpl.newKnowledgeBase  - Process Compilation error : org.drools.lang.descr.ProcessDescr at 79024994
     defaultPackage/Process_defaultPackage_Sample_Process_4419562b234b4de3b32f940de6602c9f.java (11:468) : person cannot be resolved

Exception in thread "main" java.lang.IllegalArgumentException: Could not parse knowledge.
    at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilderImpl.java:79)
    at com.sample.JBPMTest.main(JBPMTest.java:23)

How to get parameters in script action?
Thank you!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792880#792880]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130118/65d38ac3/attachment-0001.html 


More information about the jboss-user mailing list