maven drools compiler (plugin)
by Sean Su
Hello, guys,
I did some search online and it seems we do not have any official plugin
that allows us to compile Drools rules as part of the maven build.
Is this the case or I have not found it yet?
Thanks for the help.
Sean
--
"But beware of the Dark Side. Anger, fear, aggression - the Dark Side of
the Force are they." -Yoda
12 years, 7 months
Drools crash on simple drl
by Shur, Bob
I have what looks to me like a Drools bug on a simple drl with declared classes. I'm using version drools-distribution-5.3.0.Final.
I'm invoking it with this:
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
List<Object> facts = new ArrayList<Object>();
ksession.execute( facts );
=============================
I get this crash:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sample/Cap
at ASMAccessorImpl_129541121334339192620.getValue(Unknown Source)
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:73)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:103)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
at org.mvel2.MVEL.executeExpression(MVEL.java:952)
...
==========================
Here's the drl file:
package com.sample
import com.sample.*;
declare Item
id : int;
end
declare Priority
name : String;
priority : int;
end
declare Cap
item : Item;
name : String
end
rule "split cart into items"
when
then
insert(new Item(1));
insert(new Item(2));
insert(new Item(3));
end
rule "Priorities"
when
then
insert(new Priority("A", 3));
insert(new Priority("B", 2));
insert(new Priority("C", 5));
end
rule "Caps"
when
$i : Item()
$p : Priority($name : name)
then
insert(new Cap($i, $name));
end
rule "test"
when
$i : Item()
Cap(item.id == $i.id)
then
System.out.println("Cap");
end
====================
Some observations:
- If I comment out any of the insert lines, the crash goes away
- If I change the first field of class Cap to be id:int instead of item:Item and make the corresponding changes, the crash goes away
12 years, 7 months
Runtime Java Exception - Firing rules (Drools Expert 5.2.1).
by groovenarula
Hello all,
We're getting the following exception executing our rules in Drools 5.2.1 :
WARN: Execution of JMS message listener failed
java.lang.NoClassDefFoundError: org/drools/factmodel/traits/Thing
at
org.drools.compiler.PackageBuilder.initBuiltinTypeDeclarations(PackageBuilder.java:332)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:310)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:205)
at
org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)
at
com.anteil.lazboy.lzbws.pricing.AddDRTDRLRFToKBuilder.<init>(AddDRTDRLRFToKBuilder.java:31)
at
com.anteil.lazboy.lzbws.pricing.PricingUploadJMSConsumer.<init>(PricingUploadJMSConsumer.java:30)
at
com.anteil.lazboy.lzbws.pricing.DealerPricingUploadConsumer.<init>(DealerPricingUploadConsumer.java:11)
at
com.anteil.lazboy.lzbws.pricing.PricingUploadJMSConsumer.getConsumer(PricingUploadJMSConsumer.java:64)
at
com.anteil.lazboy.lzbws.pricing.PricingUploadJMSConsumer.executeUpload(PricingUploadJMSConsumer.java:82)
at
com.lazboy.lzbws.jms.message.PricingUploadValidationRequest.onMessage(PricingUploadValidationRequest.java:60)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException:
org.drools.factmodel.traits.Thing
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 20 more
The issue is that I can't seem to find the class
org.drools.factmodel.traits.Thing in any Drools 5.2.1 modules.
Can someone tell me the possible causes?
Thanks in advance
--
cheers
Gurvinder
--
View this message in context: http://drools.46999.n3.nabble.com/Runtime-Java-Exception-Firing-rules-Dro...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Runtime jitting exception while inserting facts
by sumatheja
Hi All,
I'm getting some wierd exception while trying to insert a fact. I'm
trying to compare a string field in a rule, like metricclass == "PROCESSOR"
java.lang.RuntimeException: Exception jitting: metricclass == "PROCESSOR"
at
org.drools.rule.constraint.MvelConstraint.jitEvaluator(MvelConstraint.java:168)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:137)
at
org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:99)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:458)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:211)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:239)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:336)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:297)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:887)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:846)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:259)
at
mattelli.re.ComplianceEngine.loadProductMetricDB(ComplianceEngine.java:1644)
at
mattelli.re.ComplianceEngine.ComplianceRunService(ComplianceEngine.java:196)
at mattelli.re.ComplianceEngine.main(ComplianceEngine.java:80)
Caused by: java.lang.IllegalAccessError: tried to access field
org.drools.rule.builder.dialect.asm.ClassGenerator$MethodBody.mv from class
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitMethodInvocation(ASMConditionEvaluatorJitter.java:463)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitInvocation(ASMConditionEvaluatorJitter.java:447)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitEvaluatedExpression(ASMConditionEvaluatorJitter.java:335)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitExpression(ASMConditionEvaluatorJitter.java:324)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitObjectBinary(ASMConditionEvaluatorJitter.java:132)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitBinary(ASMConditionEvaluatorJitter.java:107)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitSingleCondition(ASMConditionEvaluatorJitter.java:66)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.jitCondition(ASMConditionEvaluatorJitter.java:54)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter$EvaluateMethodGenerator.body(ASMConditionEvaluatorJitter.java:48)
at
org.drools.rule.builder.dialect.asm.ClassGenerator$MethodDescr.write(ClassGenerator.java:478)
at
org.drools.rule.builder.dialect.asm.ClassGenerator.generateBytecode(ClassGenerator.java:50)
at
org.drools.rule.builder.dialect.asm.ClassGenerator.generateClass(ClassGenerator.java:58)
at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:64)
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jit(ASMConditionEvaluatorJitter.java:30)
at
org.drools.rule.constraint.MvelConstraint.jitEvaluator(MvelConstraint.java:166)
... 15 more
Can someone tell me the possible causes. This happens with very few facts
making it even more confusing. Thanks in advance
--
cheers
Sumatheja Dasararaju
12 years, 7 months
Drools parser error accessing ArrayList.
by groovenarula
Hi,
I have a situation where I need to iterate over an ArrayList in the RHS of a
rule. The ArrayList is created in the LHS of the rule as follows :
rule "Hello World"
dialect "mvel"
when
$cur : Message()
$others : ArrayList ( size > 0 ) from collect(Message(status ==
$cur.status, this != $cur ))
then
for ( int ctr = 0; ctr < $others.size(); ctr++)
{
System.out.println((Message) $others.get(ctr));
}
end
This works in Drools 5.1.1.
However it gives the following parser error in Drools 5.2.X :
Unable to Analyse Expression for ( int ctr = 0; ctr < $others.size();
ctr++);
{
System.out.println((Message) $others.get(ctr));
} ;:
[Error: was expecting type: java.lang.Object; but found type:
<Unknown>]
[Near : {... for ( int ctr = 0; ctr < $othe ....}]
^
[Line: 6, Column: 0] : [Rule name='Hello World']
java.lang.IllegalArgumentException: Could not parse knowledge.
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:50)
at com.sample.DroolsTest.main(DroolsTest.java:23)
What am I missing here ? Any insight on a possible solution is appreciated.
This has become a big stumbling block for us to move from 5.1.1 to 5.2.1.
Thanks in advance,
Gurvinder
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
WS Custom Form not working in Guvnor
by sams
I can provide all the info - select a Fact type, select a field, provide and
URL, and provide height and width. Click OK then File | Save changes.
However, it doesn't look like my form is actually getting saved. When I go
back to the tab its not there, and it doesn't appear in the guided editor
when working with the field that its mapped to.
Am using version 5.3.0 in Tomcat on Windows.
Any help is appreciated.
Thanks,
Sam
--
View this message in context: http://drools.46999.n3.nabble.com/WS-Custom-Form-not-working-in-Guvnor-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Writing really short rules
by Adam Warski
Hello,
I have some near-tabular data which I would like to write down as rules.
There about 100 rows. Using a custom DSL, the shortest form I now have for
each entry is:
rule "..."
when some condition with data from row
then always the same action
end
so 4 lines.
Is it possible to somehow write it in one line? If I simply try to do that,
the parser complains (as I have a .dslr file).
Alternatively, is it possible to write down a decision table not in excel,
but using plain text? As this would work for me as well.
Thanks,
Adam
--
View this message in context: http://drools.46999.n3.nabble.com/Writing-really-short-rules-tp3903485p39...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Getting Exception while using Array in rules template
by Manikandan Subramanian
I am getting exception when using Array in combination with "in (...)".
Below is the exception
[Error: unable to resolve method: java.util.HashMap.countyName()
[arglength=0]]
and below is the template I have created
template header
stateName
countyName[]
totalPremium
package org.drools.bpmn2
template "Premium"
stateName
totalPremium
rule "Premium_(a){row.rowNumber}"
ruleflow-group "insurance premium"
when
Input(stateName == @{stateName}, countyName in (@{countyName}))
then
System.out.println("total premium " + @{totalPremium});
end
end template
the excel sheet is having the data, the column corresponds to countyName as
CSV value with variable number of variables either empty or 1 or 2 and so
on.
If I give the when like below it works (with countyName0 instead of
countyName).
when
Input(stateName == @{stateName}, countyName in (@{countyName0}))
Do I need to use foreach to generate the countyName sequence like
countyName0, countyName1 .. etc to put it in the "in (...)" condition?
I didnt find much documention about templates that covers foreach with in.
Please help. Any examples or samples would be helpful.
--
Thanks,
Mani
12 years, 7 months