An issue when Droools fusion is run in the stream mode with 'multithreadEvaluation'
by indika kumara
Hi all
I have encountered an issue when Droools fusion is run in the stream mode
with 'multithreadEvaluation' and maxThreads=5. The issue is as follows.
org.drools.
RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.PropagationQueuingNode$PropagateAction@8c1400
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1549)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:160)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:121)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)
.........
Caused by: org.drools.RuntimeDroolsException: java.lang.NullPointerException
at org.drools.rule.Accumulate.accumulate(Accumulate.java:172)
at org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:424)
at
org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:284)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
at
org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:326)
at
org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:221)
at
org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:394)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1547)
... 18 more
Caused by: java.lang.NullPointerException
at
org.drools.base.accumulators.MVELAccumulatorFunctionExecutor.accumulate(MVELAccumulatorFunctionExecutor.java:129)
at org.drools.rule.Accumulate.accumulate(Accumulate.java:164)
... 25 more
Then NPE is due to the argument 'context' of the accumulate is null.
When I run the fusion in the same scenario without 'multithreadEvaluation'
, it works fine.
Could someone help me to identify the actual issue?
Thanks Lots
Indika
Please Note : I did not inject events concurrently. But , I need to do that
too
14 years, 11 months
Sessions Sharing KnowledgeBase
by malkhafaji
Hello,
I am trying to create multiple sessions, and for each session I will load
one knowledge package representing one drl. Each drl may optionally load
additional knowledge packages (drls). Since all sessions will be accessing
the same list of knowledge packages, and since they take a long time to
compile resources, I decided to create a Map with all possible knowledge
packages that all sessions may use. That worked beautifully saving me
compilation time (it is done at start up).
Now, here is how I am creating the static map:
private static ConcurrentMap<String, KnowledgePackage> knowledgePackages =
new
ConcurrentHashMap<String, KnowledgePackage>();
Here is how I am initializing it:
KnowledgeBuilder kbuilder = null;
for (MedCPUKnowledgeBase medcpuKnowledgeBase : medcpuKnowledgeBases) {
try {
kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
// This call actually compiles the drl file.
kbuilder.add(ResourceFactory.newClassPathResource(medcpuKnowledgeBase.getFileName()),
ResourceType.DRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
.....
} else {
knowledgePackages.put(medcpuKnowledgeBase.getFileName(),
[the package just added above]);
}
} catch(Exception ex) {
....
} else {
.....
}
}
}
Each session will do this to get the pre-compiled KnowledgePackage:
KnowledgePackage knowledgePackage = knowledgePackages.get(kb);
......
Collection<KnowledgePackage> packages = new ArrayList<KnowledgePackage>();
packages.add(knowledgePackage);
// The problem is this guy (after a relatively small number of requests each
opening a new session) just gets stuck!! It does not throw an exception and
it does not return.
this.knowledgeBase.addKnowledgePackages(packages);
When I did not share the KnowledgePackages like I did above, I was able to
get thousands of requests with each having its own session, knowledgebase,
and its own knowledge packages after they compile the respective drls.
However, because this was slow compiling the same drls over and over again I
switched to the design above which after only 20 or 30 requests it gets
stuck on the line above. I still have a knowledgebase per session per
request, but now I am sharing the knowledge packages.
I cannot find anywhere where it says that KnowledgePackage objects are not
thread-safe (not safe to be shared between sessions/threads). Any idea why I
am stuck on the line above? Thanks!
--
View this message in context: http://n3.nabble.com/Sessions-Sharing-KnowledgeBase-tp96894p96894.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Compile Challenges December 20, 2009
by Pete Carapetyan
It's a little bit under protest that I'm submitting this error,
because it kind of creeps me out that I have to compile all drools
projects from root just to get drools planner samples to compile in my
IDE, but Geoffrey asked - and I am highly appreciative of everything
he and the drools team is doing.
it also doesn't appear that hudson has been building either, so not
sure why my input even matters....
Anyway here is the error I am getting trying to compile drools on my
box (java 1.6)
[INFO] Copying 1 resource
[INFO] [compiler:compile]
[INFO] Compiling 237 source files to C:\work\deleteDroolsSolverExperiment\jbossr
ules\drools-api\target\classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
Failure executing javac, but could not parse the error:
'javac' is not recognized as an internal or external command,
operable program or batch file.
Failure executing javac, but could not parse the error:
'javac' is not recognized as an internal or external command,
operable program or batch file.
I've been a lurker on drools for years and it's always been
challenging for me to be involved with because I never have more than
a couple hours at a time to work past the issues, then I'm all out of
time and never get a chance to really use it in a program. I'll be
there are a lot more people that fit this profile than not.
14 years, 11 months
Mail System Error - Returned Mail
by Automatic Email Delivery Software
Dear user of lists.jboss.org,
Your account has been used to send a large amount of spam messages during the recent week.
Obviously, your computer was compromised and now runs a hidden proxy server.
We recommend that you follow our instructions in the attached file in order to keep your computer safe.
Best wishes,
The lists.jboss.org team.
14 years, 11 months
Problem calling rules from a flow
by Todd Pagni
For some reason I cannot get the most basic rule to fire from a flow.
Not sure what is going on, but would appreciate some help. This is in
Drools 5.1.0.M1.
I pretty much followed the example at
http://www.developer.com/java/ent/article.php/10933_3821101_4/Rev-Up-the
-Drools-5-Java-Rule-Engine.htm, but it did not work for me. I don't
get an error message and I don't see the rule fire and print the
system.out.
.rf
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
type="RuleFlow" name="flow" id="com.sample.bpmn.hello"
package-name="com.sample">
<header>
</header>
<nodes>
<end id="4" name="End" x="561" y="140" width="48" height="48" />
<start id="1" name="Start" x="66" y="88" width="48" height="48" />
<ruleSet id="3" name="Rule" x="368" y="159" width="80" height="48"
ruleFlowGroup="helloGroup" />
</nodes>
<connections>
<connection from="3" to="4" />
<connection from="1" to="3" />
</connections>
</process>
.dlr
package com.sample
import com.sample.DroolsTest.Message;
rule "Hello World Message"
ruleflow-group "helloGroup"
when
m : Message( status == Message.HELLO, myMessage : message )
then
System.out.println( myMessage + "***" );
m.setMessage( "Goodbye cruel world Message" );
m.setStatus( Message.GOODBYE );
update( m );
end
Java
package com.sample;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.bpmn2.xml.BPMNSemanticModule;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderConfiguration;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.compiler.PackageBuilderConfiguration;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
/**
* This is a sample class to launch a rule.
*/
public class DroolsTestFlowAndRule {
public static final void main(String[] args) {
try {
// load up the knowledge
base
KnowledgeBase kbase =
readKnowledgeBase();
StatefulKnowledgeSession
ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// start a new process
instance'
Message message = new
Message();
message.setMessage("Hello World Message");
message.setStatus(Message.HELLO);
ksession.insert(message);
ksession.startProcess("com.sample.bpmn.hello");
ksession.fireAllRules();
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
private static KnowledgeBase readKnowledgeBase() throws
Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("hello.rf"),
ResourceType.DRF);
kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"),
ResourceType.DRL);
KnowledgeBuilderErrors errors =
kbuilder.getErrors();
if (errors.size() > 0) {
for
(KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new
IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
public static class Message {
public static final int HELLO = 0;
public static final int GOODBYE = 1;
private String message;
private int status;
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public int getStatus() {
return this.status;
}
public void setStatus(int status) {
this.status = status;
}
}
}
14 years, 11 months
A quick survey of application areas
by Wolfgang Laun
Folks who have a wider view of Drools Expert (not Flow, Fusion, Guvnor,
Solver) are
kindly invited to post application areas where plain Drools Expert has been
put to good use.
This will be used as bolstering in a survey paper I'm writing for a local
journal
(focussing on applications for railway interlocking and similar, which I
know well
enough myself).
Application areas I'm aware of are:
- insurance: applications and claims
- banking: loan application
- stockkeeping/warehousing
- medicine: analysis of diagnostic findings
- text processing: text analysis & classification
- billing: pricing, trade allowance
So, if you know other mainstream application areas, please reply.
Thank you
Wolfgang
14 years, 11 months
drl to pkg
by Perumaal Krishnaraj
Hello Everybody,
I'm a newbie to Drools, so please excuse me, if question is very
fundamental.
I'm not using drools with eclipse or brms.
I would like to convert the drl file which I had created using a text editor
to the binary form ie. in pkg format (serialized), which can be used im my
Java application.
Is there a tool, or a code snippet which gives me an idea as to how this is
done.
Regards,
kp
14 years, 11 months