[jBPM] - Re: jBPM 5.1 in a real world web application
by Krishna Pitla
Krishna Pitla [https://community.jboss.org/people/krishnapitla] created the discussion
"Re: jBPM 5.1 in a real world web application"
To view the discussion, visit: https://community.jboss.org/message/748004#748004
--------------------------------------------------------------
hi ashutosh,
try out this code kbuilder.add(ResourceFactory.+newClassPathResource+(
"simplerule.drl"), ResourceType.++DRL++);
in your code where you try to start the process .
Sample code pasted below :
***package
**
* com.sample;
***import
**
org.drools.KnowledgeBase;
***import
**
org.drools.builder.KnowledgeBuilder;
***import
**
org.drools.builder.KnowledgeBuilderFactory;
***import
**
org.drools.builder.ResourceType;
***import
**
org.drools.io.ResourceFactory;
***import
**
org.drools.runtime.StatefulKnowledgeSession;
/**
* This is a sample file to launch a process.
*/
***public
**
**class** ProcessMain {
**public** **static** **final** **void** main(String[] args) **throws** Exception {
// load up the knowledge base
KnowledgeBase kbase = +readKnowledgeBase+();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
// start a new process instance
ksession.startProcess(
"com.sample.bpmn.hello");ksession.insert(
**new** Account());ksession.fireAllRules();
}
**private** **static** KnowledgeBase readKnowledgeBase() **throws** Exception {KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.+newKnowledgeBuilder+();
kbuilder.add(ResourceFactory.+newClassPathResource+(
"simplerule.drl"), ResourceType.++DRL++);
kbuilder.add(ResourceFactory.+newClassPathResource+(
"sample.bpmn"), ResourceType.++BPMN2++);
**return** kbuilder.newKnowledgeBase();} }
*******
Hope this helps . Though i am still new to jbpm and drools. So if i have missed something then please pardon me.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/748004#748004]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 5 months