RuleAgent in webservice
by shekharputtur puttur
Hi All,
I am using drools API, and developed a webservice out of it.
I created rule binary package using BRMS Guvnor.
I used RuleAgent to acces the properties file.
ie RuleAgent agent = RuleAgent.newRuleAgent("/
application.properties");
"application.properties" file was stored in current working directory.
I executed my application using eclipse, it was fine .
For testing purpose i deployed the application in tomcat application
server.
Now it is unable to find "application.properties" file. and shows following
in "catalina.out" file:
java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:418)
at java.util.Properties.load0(Properties.java:337)
at java.util.Properties.load(Properties.java:325)
at org.drools.agent.RuleAgent.loadFromProperties(RuleAgent.java:299)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)
My question is, in which location should i keep the "application.properties"
file , so that RuleAgent can access it.
Could you please tell me the solution.
Thanks & Regards
Shekhar
14 years, 6 months
Exception handling policy
by Gerret Hansper
Hello,
I have got a question about Exception handling policy in Drools 5.0.
My issue is a case where a client application triggered rule execution on the
server, which was throwing a ConsequenceException.
The client, not having drools libs in its classpath, then had a
ClassNotFoundException.
I would therefore want to catch the ConsequenceException on the server and throw
an Exception with its cause.
I am not sure however if ConsequenceException.getCause() would always yield a
non-drools Exception or if that might be another drools type.
Also, is it always a ConsequenceException that gets thrown from a session or can
there be other Exception types?
Thanks,
Gerret
14 years, 6 months
Drools Roadmap - Planned Release 5.1 release date
by McDonald, Daniel
Hi,
I was wondering if there is a planned release date for Release 5.1?
Thank you,
Daniel McDonald
Fidelity National Information Services - Research & Development
Office phone: (972) 691-6593
Mobile phone (214) 697-8163
_____________
The information contained in this message is proprietary and/or confidential. If you are not the
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose,
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition,
please be aware that any message addressed to our domain is subject to archiving and review by
persons other than the intended recipient. Thank you.
_____________
14 years, 7 months
Drools memory usage issue
by Shah, Malay
Hi,
We have an drools 5.0.1 application that uses StatelessSession and high volume of objects (facts) that we need to apply static rules on, and having out of memory issues doing so. We added the following three properties as given in the drools documentation for decreasing the memory usage:
drools.shadowproxy=false
drools.maintainTms=false
drools.sequential=true
As per the following blog, there is an algorithm to minimize the engine work, and memory usage.
http://blog.athico.com/2007/07/sequential-rete.html
Are the properties above sufficient to trigger this algorithm, or do we need to do write extra code for this?
Also, does the "drools.sequential" property make sure that rules are applied sequentially on facts? If so, is there a hook into the drools engine to figure out which particular rule is consuming more memory or having more execution time?
Thanks in advance.
Malay Shah
--------------------------------------------------------------------------
NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We may monitor and store emails to the extent permitted by applicable law.
14 years, 7 months
ClassCastException during inserting knowledge package
by Piotr Jedrychowski
Hello.
I have a problem with such scenario:
1) add one knowledge package (sensor200) with two rules:
package sensor200
rule "Sensor-200-ON"
when
(and f0: FMSensorFact(id==201) f1: FMSensorFact(id==202) )
(not FMFact(id==200))
then
FMFact factToInsert = new FMFact(200);
insert(factToInsert);
end
package sensor200
rule "Sensor-200-OFF"
when
not (and FMSensorFact(id==201) FMSensorFact(id==202) )
(factToRetract : FMFact(id==200))
then
retract(factToRetract);
end
2) remove knowledge package (sensor200)
3) add knowledge package with the same name as in point 1, but with
other rule:
package sensor200
rule "Sensor-200-OR-201-ON"
when
fact: FMSensorFact(id==201)
(not FMFact(id==200))
then
FMFact factToInsert = new FMFact(200);
insert(factToInsert);
end
During adding knowledge package in point 3, I'm getting
ClassCastException with this Stacktarce:
java.lang.ClassCastException: org.drools.util.ObjectHashMap
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:142)
at org.drools.reteoo.ObjectTypeNode.updateSink(ObjectTypeNode.java:252)
at org.drools.reteoo.AlphaNode.attach(AlphaNode.java:133)
at org.drools.reteoo.builder.BuildUtils.attachNode(BuildUtils.java:160)
at
org.drools.reteoo.builder.PatternBuilder.attachAlphaNodes(PatternBuilder.java:295)
at
org.drools.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:117)
at org.drools.reteoo.builder.PatternBuilder.build(PatternBuilder.java:70)
at
org.drools.reteoo.builder.GroupElementBuilder$NotBuilder.build(GroupElementBuilder.java:228)
at
org.drools.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:73)
at
org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:126)
at
org.drools.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:73)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:153)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:126)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:117)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:362)
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:618)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:500)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:379)
at
org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:121)
Maybe someone had similar problem and could help me?
I'm using:
* JBoss 4.2.3.GA
* Drools 5.0
Regards,
Piotr
14 years, 7 months
ANT Compile issues
by Bhamidi, Krishna
Hi,
I am using DROOLs 5.0.0 CR1 and use the compiler from Drools-Ant. When I attempt to execute the rules using a rule agent, I get an exception that in part reads
java.lang.NullPointerException
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1820)
(Full stack follows this e-mail.) However, when I download the pkg file for the same ruleset from Guvnor and use it in the rule agent, it runs fine.
I use the following for building -
<taskdef name="compiler" classname="org.drools.contrib.DroolsCompilerAntTask" classpathref="compiler.classpath" />
<compiler srcdir="../${rulesDirectory}" tofile="../${buildDirectory}/${projectName}_rules.pkg"
classpath="../${buildDirectory}/${projectName}_rules.jar"
binformat="package">
<include name="*.drl" />
<include name="*.brl" />
<include name="*.xml" />
<include name="*.dslr" />
<include name="*.xls" />
</compiler>
What I should do to compile correctly?
Full Stack
java.lang.NullPointerException
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1820)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:41)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.rule.Package.readExternal(Package.java:197)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189)
at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:158)
at org.drools.agent.FileScanner.readPackage(FileScanner.java:136)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:82)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:56)
at org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:69)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:410)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:362)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:347)
at org.drools.agent.RuleAgent.init(RuleAgent.java:247)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:187)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:147)
14 years, 7 months
ClassCastException: org.drools.reteoo.RuleTerminalNode$TerminalNodeMemory cannot be cast to org.drools.reteoo.EvalConditionNode$EvalMemory
by Paul Ryan
Hi all,
We're receiving some error messages that we don't understand from rules that had conditionals that worked and now don't (no upgrade or anything like that, they just stopped working), any clues as to what kinds of things to look for when we get an error like the following? (if not we can try to pair down to an a test case)
org.drools.runtime.rule.ConsequenceException: java.lang.ClassCastException: org.drools.reteoo.RuleTerminalNode$TerminalNodeMemory cannot be cast to org.drools.reteoo.EvalConditionNode$EvalMemory
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183)
at com.infotrustgroup.rules.engine.RulesManager.runRules(RulesManager.java:353)
at com.infotrustgroup.util.rules.RuleFileUtil.runRules(RuleFileUtil.java:406)
at com.infotrustgroup.util.rules.RuleFileUtil.runRules(RuleFileUtil.java:370)
at com.infotrustgroup.util.rules.RuleRunner.run(RuleRunner.java:395)
at com.infotrustgroup.util.rules.RuleRunner.call(RuleRunner.java:193)
at com.infotrustgroup.jobs.services.auth.EditionsRulesJobRunner.runRules(EditionsRulesJobRunner.java:87)
Caused by: java.lang.ClassCastException: org.drools.reteoo.RuleTerminalNode$TerminalNodeMemory cannot be cast to org.drools.reteoo.EvalConditionNode$EvalMemory
at org.drools.reteoo.EvalConditionNode.retractLeftTuple(EvalConditionNode.java:199)
at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:159)
at org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:68)
at org.drools.reteoo.JoinNode.retractLeftTuple(JoinNode.java:231)
at org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:239)
at org.drools.reteoo.EntryPointNode.retractObject(EntryPointNode.java:195)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1416)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1360)
at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:141)
at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:154)
at com.infotrustgroup.what.Rule_Transform_SGML_to_XML_0.consequence(Rule_Transform_SGML_to_XML_0.java:48)
at com.infotrustgroup.what.Rule_Transform_SGML_to_XML_0ConsequenceInvoker.evaluate(Rule_Transform_SGML_to_XML_0ConsequenceInvoker.java:34)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
... 11 more
Thanks in advance for your help with this,
-- Paul Ryan
14 years, 7 months
Any news on Drools 5.1
by Chuck Irvine
I am planning on diving into a Drools based workflow related project pretty
soon and have kind of been waiting for 5.1 to come out (or maybe the next
milestone release). Any news on 5.1 availability? Thanks -Chuck
14 years, 7 months
Drools + ETL Process
by andre.fonseca@mail.com
Hi all,
I am using Drools 5.0 with Tomcat 6 and MySQL.
Now I need to insert data in the drools database but I DON'T want to use the Guvnor interface.
This is because in the future we'll need to use a kind of ETL process to populate the drools database.
Should I create a java class with JDBC access and perform a SQL direct to that tables?
I did the reverse engineering of the drools database but I could not understood yet where the data are persisted.
Any advice should be very helpful.
Thanks in advance.
14 years, 7 months
How to make this rule more memory efficient?
by Ryan Fitzgerald
Hi,
Can anyone advise me on how to make a drools rule more memory efficient? Here is the problem:
I have a Cell and a ProxyCell object classes.
The ProxyCell represents the Cell when their internal ID's match.
Each Cell and ProxyCell however has a unique name (not same as ID).
A Cell can reference (by name) a ProxyCell (as long as the ProxyCell does not represent that actual Cell - which would effectively be a self-reference and is not allowed).
What I want to do is find out where I have a reference from any instance of Cell - cell1 - to any instance of ProxyCell - proxycell2 - but am missing a reference from cell2 to proxycell1 where proxycell2 is a representation of cell2 and proxycell1 is a representation of cell1.
Here is the rule I have written for it:
rule "Check consistent references"
when
$cell1 : Cell()
$cell2 : Cell()
$proxycell1 : ProxyCell ( id = $cell1.id, $cell2.references contains this.name )
$proxycell2 : ProxyCell ( id = $cell2.id, $cell1.references not contains this.name )
then
//report an error.....
end
I have 10,000 instances of Cell and 10,000 instances of ProxyCell in working memory. For each instance of Cell, it can have references to 60 different ProxyCell instances. Loading the Cell and ProxyCell instances into working memory is not a problem. However, when I try to run this rule above, the memory quickly goes above 1GB and I eventually get an out of memory error.
I was wondering if there is a better way to structure or write this rule so that it doesn't use so much memory.
Thanks,
Ryan.
14 years, 7 months