Hi All
I am also trying to build a dynamic process to be used. I am having some
difficulties in the build where I having this exception below is the sample
code that I am using:
java.lang.NoClassDefFoundError: sample/Process_sample_0
at
sample.Process_sample_0Action0Invoker.execute(Process_sample_0Action0Invoker.java:20)
Also I have a question can I use this dynamic process inside the GWT web
console? and How?
Please help in this issue
public static final void main(String[] args)
{
try
{
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
org.drools.rule.Package p = new
org.drools.rule.Package("sample");
RuleFlowProcess process = createProcess();
p.addProcess(process);
KnowledgePackageImp kpi = new KnowledgePackageImp();
kpi.pkg = p;
List<KnowledgePackage> list = new ArrayList<KnowledgePackage>();
list.add(kpi);
org.drools.compiler.PackageBuilder pbuilder = new
PackageBuilder();
pbuilder.addPackage(p);
org.drools.compiler.ProcessBuilder builder = new
ProcessBuilder(pbuilder);
builder.buildProcess(process, null);
kbase.addKnowledgePackages(list);
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
System.out.println("=======>>> process.getId()
["+process.getId()+"]");
// starting the process
ksession.startProcess( process.getId() );
ksession.fireAllRules();
}
catch (Throwable t)
{
t.printStackTrace();
}
}
public static RuleFlowProcess createProcess()
{
String processName = "org.drools.HelloWorldJoinSplit";
RuleFlowProcessFactory factory =
RuleFlowProcessFactory.createProcess(processName);
factory
// Header
.name("HelloWorldJoinSplit")
.version("1.0")
.packageName("sample")
// Nodes
.startNode(1).name("Start").done()
.actionNode(2).name("Action 1")
.action("java", "System.out.println(\"Inside Action
1\")").done()
.endNode(3).name("End").done()
// Connections
.connection(1, 2)
.connection(2, 3);
RuleFlowProcess process = factory.validate().getProcess();
System.out.println(" ====== >> ["+process.getId()+"]");
return process;
}
--
View this message in context:
http://old.nabble.com/How-to-execute-a-Process-API-result--tp26169577p264...
Sent from the drools - user mailing list archive at
Nabble.com.