InstantiationError during condition evaluation in Drools 6.0.0.Final
by Loïc Albertin
Hi all,
I'm migrating from an old Drools 5.1 version to 6.0.0.Final. Sometimes
(I don't really get under which conditions as sometimes it works), I'm
facing an InstantiationError exception when I insert a fact into a
stateful kie session. This exception is thrown by a generated class
named ConditionEvaluator<UUID> which doesn't help for debugging! ;)
The inserted object is a basic POJO (named JasmineEventEB) except for an
attribute named "value" which accept any "Serializable" object and which
is causing the issue.
The rule condition is quite simple
$e : JasmineEventEB(probe == "Button:pris" && value == "1")
In debugging I found that it failed when evaluating the value == "1"
part. I can also confirm that the value for the actually inserted
JasmineEventEB is a string.
The stacktrace is:
java.lang.InstantiationError: java.io.Serializable
at
ConditionEvaluatorae1a73837e8146bda23004a0450e2e52.evaluate(Unknown Source)
at
org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:212)
at
org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:169)
at
org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:134)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:502)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:387)
at
org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:138)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:502)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:377)
at
org.drools.core.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:288)
at
org.drools.core.reteoo.EntryPointNode.assertObject(EntryPointNode.java:260)
at
org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:360)
at
org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:279)
at
org.drools.core.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1149)
at
org.drools.core.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1093)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:308)
I tested both with the java and mvel dialect with the same result.
Does someone has already encountered this kind of error?
If you need more details or clarifications please let me know.
Thanks & regards,
Loïc
10 years, 11 months
Drools 5.5.0.Final : Rule Trigger Issue
by Zahid Ahmed
Hi,
I am new to Rules and having following issues in different rules.
Rule 1 :
Issue
I have a process definition in which I create and insert into Session a REQUEST.java object before the rule-flow node. Insert is done using script node. In rule condition section I am filtering the same request object but my rule is not firing. My rule FIRES if I REMOVE this == $process.getVariable("piRequest").
rule "Go to President"
ruleflow-group "DesigSkip"
dialect "java"
when
$process: WorkflowProcessInstance()
$r: Request(this == $process.getVariable("piRequest"), VD == "N", UB == "N", CC not in ( "A", "B") , DP not in ( "X", "Y", "Z") );
then
$process.setVariable("piToPres","y");
end
Rule 2 :
I am getting error for eval statement.
globa Request $r;
rule "Go to President"
ruleflow-group "DesigSkip"
dialect "java"
when
$process: WorkflowProcessInstance($request:getVariable("piRequest"))
$r : $request
$r(eval(ADV == "N"))
then
System.out.println("--------------------*******************--------IN GUIDED RULE--------**********************---------------");
$process.setVariable("piToPres","y");
end
globa Request $r;
rule "Go to President"
ruleflow-group "DesigSkip"
dialect "java"
when
$process: WorkflowProcessInstance($request:getVariable("piRequest"))
$r : $request
eval($r.getADV() == "N")
then
System.out.println("--------------------*******************--------IN GUIDED RULE--------**********************---------------");
$process.setVariable("piToPres","y");
end
Zahid Ahmed
Senior Software Engineer | Emirates Group IT
P.O. Box 686 | Dubai, United Arab Emirates
T +971 4 203 3912 | M +971 55 1249171
[http://cdn.ek.aero/email/e_signatures/ekg2013.jpg]
10 years, 11 months
6.0 issue with remote jars and dynamic modules
by Mark Proctor
There is problem, fixed in master, for remote jars. The KieRepository currently, when using kie-ci, doesn’t obey the settings.xml active profiles. This means it is not recognising the remote configured repositories.
While this is fixed, and we’ll have binaries out in about 2 weeks, it means for now KieRepository can only resolve jars already in the local m2_repo.
Mark
10 years, 11 months
Insert to non-existing entry point causing NPE in drools server?
by dunnlow
I am sending events to drools integration server (5.5). I have a good number
of rules so I am looking at using entry points to speed things up. My
client app will send to an entry point based on the value of one of the
event attributes. While I will typically know all possible attributes, I
may occasionally get an event that has an attribute value that I have 1) not
foreseen, and/or 2) don't need any rules for. Whenever I insert an event to
an endpoint however for which I have no rules, I get a nullpointerexception
from the drools server.
Is there a way to handle this? I am considering having my client app do a
lookup in the ksession (which is persisted to a db) to determine all of the
entry points and then, if the event attribute received isn't one of them,
send to the DEFAULT entry point. Is there an easier way?
Here's a sample use case: I have am receiving events based on automobile
models. I have rules for Ford models at the Ford entry point and Honda
models at the Honda entry point. I don't care about a car if it's a Toyota,
so I have no rules (/entry points) for them. However, all events go to the
rule engine. If I send the Toyota event to the drools server, I get an
internal server error from the drools server.
Any thoughts?
Thank you,
-J
--
View this message in context: http://drools.46999.n3.nabble.com/Insert-to-non-existing-entry-point-caus...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 11 months
Drools 6.0.0: Please clarify: rdrl vs rdslr and what you can do with each
by SrjTx
Drools 6.0.0
I have searched doc and google, but have not found what I am looking for -
if you have link that would be great too.
I am creating my first .dsl file and using them in a guided rule. I notice
that when you select this, the file extension is rdslr versus rdrl. Also,
you can access any .dsl (that is in the project? directory? - not clear
where all it searches)
I also notice that you can add "regular" rule parts just like a rdrl file,
but they are prefixed with a >
My question is, if you wanted, could you write only rdslr files and do
everything you could in a rdrl even if you didn't use any dsl?
Rephrased, is rdrl a subset of rdslr functionality?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-0-Please-clarify-rdrl-vs-rds...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 11 months
Stateless session commands and ExecutionResults (5.5.0.Final)
by Stephen Masters
Hi folks,
Can anyone explain how stateless session execution results should work? Working through the docs and tracing the code, it’s getting a bit confusing.
Firstly, according to the user manual, one should be able to insert a list of facts as a Command, and get an instance of ExecutionResults back, which can then be queried. Here’s the example code:
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
Command cmd = CommandFactory.newInsertElements( Arrays.asList( Object[] {
new Cheese( "stilton" ),
new Cheese( "brie" ),
new Cheese( "cheddar" ),
});
ExecutionResults bresults = ksession.execute( cmd );
That doesn’t compile, so I fixed it as follows:
Command cmd = CommandFactory.newInsertElements( Arrays.asList(
new Cheese( "stilton" ),
new Cheese( "brie" ),
new Cheese( "cheddar" )
));
ExecutionResults bresults = ksession.execute( cmd );
This does now compile, but running it throws a ClassCastException:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.drools.runtime.ExecutionResults
Taking a look through the Drools code, it would appear that Command has a generic type, which in the case of an InsertElementsCommand is:
GenericCommand<Collection<FactHandle>>
In turn, the execute command in StatelessKnowledgeSessionImpl casts its result to that generic type:
public <T> T execute(Command<T> command) {
Object o = ((GenericCommand) command).execute( context );
...
return (T) o;
So the ClassCastException is because the execute method returns an ArrayList of FactHandle instead of an ExecutionResults.
I’m assuming that I must have got the wrong end of the stick somewhere, so what should I be doing to get an ExecutionResults from a stateless session, which I can then query?
Cheers,
Steve
10 years, 11 months
Accessing items in a list
by mkhan
Hi,
I am new to doorls so please can you help me.
I am trying to access an ietm from a list in a rule like ...
$data: List(this != null, size > 9) from accumulate(
$obj1 : FwVehicle(
notchCodingWire1 != null,
lineVoltage != null
)
over window:time(10s)
from entry-point "DataStream",
collectList($obj1)
)
$first : $data.get(0)
but i get an error ...
[ERR 102] Line 164:19 mismatched input '0' expecting ')' in rule "test1" in
pattern $data.get
Does anyone have any ideas what I am doing wrong please?
--
View this message in context: http://drools.46999.n3.nabble.com/Accessing-items-in-a-list-tp4027194.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 11 months