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@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]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to