Cannot find the declaration of element 'rule-set'.
by shilpa.raghavendra@wipro.com
Main Class as follows
package com.sample;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
/**
* This is a sample file to launch a rule package from a rule source
file.
*/
public class DroolsTest1 {
public static final void main(String[] args) {
try {
//load up the rulebase
RuleBase ruleBase = readRule();
WorkingMemory workingMemory = ruleBase.newWorkingMemory();
//go !
Message message = new Message();
message.setOp1(2);
message.setOp2(2);
workingMemory.assertObject( message );
workingMemory.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
/**
* Please note that this is the "low level" rule assembly API.
*/
private static RuleBase readRule() throws Exception {
//read in the source
Reader source = new InputStreamReader(
DroolsTest1.class.getResourceAsStream( "/Sample1.drl" ) );
//optionally read in the DSL (if you are using it).
//Reader dsl = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/mylang.dsl" ) );
//Use package builder to build up a rule package.
//An alternative lower level class called "DrlParser" can
also be used...
PackageBuilder builder = new PackageBuilder();
//this wil parse and compile in one step
//NOTE: There are 2 methods here, the one argument one is
for normal DRL.
//builder.addPackageFromDrl( source );
builder.addPackageFromXml( source );
//Use the following instead of above if you are using a DSL:
//builder.addPackageFromDrl( source, dsl );
//get the compiled package (which is serializable)
Package pkg = builder.getPackage();
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}
public static class Message {
int op1 ;
int op2;
/**
* @return the op1
*/
public int getOp1() {
return op1;
}
/**
* @param op1 the op1 to set
*/
public void setOp1(int op1) {
this.op1 = op1;
}
/**
* @return the op2
*/
public int getOp2() {
return op2;
}
/**
* @param op2 the op2 to set
*/
public void setOp2(int op2) {
this.op2 = op2;
}
}
}
It's in src/ java /com/ com.sample package
The sample1.drl file in src/ rules/Sample.drl is as follows
<?xml version="1.0"?>
<rule-set name="BusinessRulesSample"
xmlns="http://drools.org/rules"
xmlns:java="http://drools.org/semantics/java"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/rules rules.xsd
http://drools.org/semantics/java java.xsd">
<!-- Code for Drools Article (c)www.firstpartners.net 2005 -->
<!-- Import the Java Objects that we refer to in our rules -->
<java:import>java.lang.Object</java:import>
<java:import>java.lang.String</java:import>
<java:import>com.sample.DroolsTest1.*</java:import>
<java:functions>
public void printValues(int i, int j)
{
System.out.println("hi"+i+j);
}
</java:functions>
<!-- Check for XYZ Corp-->
<rule name="XYZCorp" >
<!-- Parameters we can pass into the business rule -->
<parameter identifier="message">
<class>com.sample.DroolsTest1.Message</class>
</parameter>
<!-- Conditions or 'Left Hand Side' (LHS) that must be met for
business rule to fire -->
<java:condition>message.getOp1()==2</java:condition>
!-- What happens when the business rule is activated -->
<java:consequence>
printValues(message.getOp1(),message.getOp2());
</java:consequence>
</rule>
</rule-set>
When I run the program I will get the following error. If I change
addPackageFromXml to addPackageFromDrl the error is same . So please
help me in this
(null: 7, 74): cvc-elt.1: Cannot find the declaration of element
'rule-set'.
org.drools.compiler.DroolsParserException
at org.drools.compiler.PackageBuilder.addPackageFromXml(Unknown
Source)
at com.sample.DroolsTest1.readRule(DroolsTest1.java:55)
at com.sample.DroolsTest1.main(DroolsTest1.java:21)
Thanks & Regards
Shilpa
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 11 months
RE: [rules-users] RE: Why not retracting?
by Anstis, Michael (M.)
Thanks Steve,
That worked a treat; it was a PEBKAC issue ;-)
The wonders a weekend can work!!
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven
Williams
Sent: 27 January 2007 21:34
To: Rules Users List
Subject: Re: [rules-users] RE: Why not retracting?
Hi Mike,
I suggest using the Audit view in eclipse (documented in the
help) which will allow you to see what rules are being added to and
removed from the agenda.
cheers
Steve
On 1/27/07, Anstis, Michael (M.) <manstis1(a)ford.com> wrote:
Thanks Jeff - I guess Rules Engines were common New
Years resolution (I'm about 2 weeks in too) ;-)
I understood that the LHS side was operated upon when
Facts were asserted which, I think, creates the RHS Activation in the
Agenda. However I also thought that if the RHS modified Facts in the
Working Memory (by retracting, asserting or modifying them) the "Two
Phase Execution" (Agenda, Section 1.6.5) reassessed which rules needed
"firing" (activation?) and hence some of the "Cost - calculate cost for
'Stamping process' on a process" rules (in my example below) would be
disposed of. Is the activation not being dropped (perhaps because the
"machine == ( m )" condition is still met all be it that the Price to
which it relates as been disposed of?). I thought we were encouraged to
write rules that didn't need to be ran in any particular order whereas I
now find myself having to run some before others?
I'm not ranting at you Jeff, I'm just confused.
Cheers,
Mike
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Grimshaw,
Jeffrey
Sent: 26 January 2007 16:34
To: Rules Users List
Subject: RE: [rules-users] RE: Why not
retracting?
Hi Michael. I've only been using JBoss Rules
for about 2 weeks, so keep that in mind when reading my reply.
The way I understand it works is that facts are
evaluated against the LHS of all the rules in the ruleset as they are
asserted. That is, when a fact is added to the WorkingMemory, the
engine determines which rules apply to that fact. You may expect that
evaluation to take place when the rules are "run". This may have
something to do with the behavior you are seeing.
For more info on what I'm talking about, see
section 1.6.4.2 of the user docs.
http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do
cs/3.0.5/html/index.html
Cheers,
--Jeff
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Friday, January 26, 2007 8:08 AM
To: Rules Users List
Subject: [rules-users] RE: Why not retracting?
By way of an update; if the retraction is made
within a different Agenda Group the rules work as expected.
However the problem of the retraction having no
obvious affect when operated within the same Agenda Group remains.
Is this a bug?
_____________________________________________
From: Anstis, Michael (M.)
Sent: 26 January 2007 11:32
To: 'Rules Users List'
Subject: Why not retracting?
Hello,
I have the following rules; one removes
"Prices" that do not have the required "Economic Level" from working
memory, the other calculates a "Costs":-
rule "Cost - remove prices that
do not have the required 'Economic Level'"
agenda-group "stamping-costs"
// salience 1
when
p : Price ( economicLevel != (
Utilities.makeDate(1, 1, 2007) ) )
then
System.out.println("Retracting
"+p.toString());
retract(p);
end
rule "Cost - calculate cost for
'Stamping process' on a process"
agenda-group "stamping-costs"
// salience 2
when
r : ResourceEntry ( m : machine
)
//p : Price ( economicLevel == (
Utilities.makeDate(1, 1, 2007) ), machine == ( m ) )
p : Price ( machine == ( m ) )
then
Cost cost = new Cost(r, p);
cost.setCost((float)
(r.getUsage() * p.getRate()));
assert(cost);
end
The problem is that the "Cost" rule
still works upon ALL "Prices" (even those with an incorrect "Economic
Level").
If I change the line in the "Cost" rule
to also check the "Economic Level" the rules work as expected (i.e.
"Costs" are only calculated using "Prices" with an "Economic Level" of
01/01/2007).
I've tried using "salience" levels too
(as commented in the above Rules) but this doesn't have any effect
either.
What am I doing wrong?
Cheers,
Mike
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
17 years, 11 months
RE: [rules-users] required some input on String comparision in xml rulefile.
by Anstis, Michael (M.)
You'll probably need to ensure the String object contains a valid object
reference and not a null.
If the database allows NULL values on a field then the String object
will be set to a null causing the problem you explain. An alternative is
to either set the String to an empty String ("") instead of null or
change your rule to first check whether the String is a null; for
example beanObject.getName() != null && beanObject.getName()=="smurf".
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mahantesh
Sent: 29 January 2007 08:58
To: rules-users(a)lists.jboss.org
Subject: [rules-users] required some input on String comparision
in xml rulefile.
Hi,
I am using Drools 3 JBoss Rule Engine and xml file as a rule
file. when i am using integer condition in LHS part of rule file it is
working fine.
For example: <eval> beanObject.getNumber >= 60 </eval>
but when using string condition in LHS part of the rule file,
it is able to filter the data when setting and getting the data from the
dummy bean, but not able to filter the data when the data is coming from
the database its throwing the exceptions like this.
For Example: <eval> beanObject.getName()</eval>
Exception like this.
org.drools.RuntimeDroolsExcept
ion: java.lang.NullPointerException
at org.drools.rule.EvalCondition.isAllowed (Unknown
Source)
at
org.drools.reteoo.EvalConditionNode.assertTuple(Unknown Source)
at
org.drools.reteoo.TupleSource.propagateAssertTuple(Unknown Source)
at org.drools.reteoo.JoinNode.assertObject (Unknown
Source)
at
org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source)
at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown
Source)
at org.drools.reteoo.Rete.assertObject (Unknown Source)
at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown
Source)
at
org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown Source)
at org.drools.common.AbstractWorkingMemory.assertObject
(Unknown Source)
at
org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
at
org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown
Source)
at
org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules (Unknown
Source)
at
rules1.TestRuleForXML.applyRuleTestingProcessVO(TestRuleForXML.java:176)
at
rules1.TestRuleForXML.applyForProcessVO(TestRuleForXML.java:55)
size of the ouput list in java file: 0
at rules1.TestRuleForXML.main(TestRuleForXML.java:47)
Caused by: java.lang.NullPointerException
at rules1.Rule_my_rule_0.eval0(Rule_my_rule_0.java:12)
at rules1.Rule_my_rule_0Eval0Invoker.evaluate
(Rule_my_rule_0Eval0Invoker.java:19)
If you do a help regarding how to work with String condition in
LHS part, it will be great..
Thanks in Advance,
Mahantesh.
17 years, 11 months
required some input on String comparision in xml rule file.
by Mahantesh
Hi,
I am using Drools 3 JBoss Rule Engine and xml file as a rule file. when i am
using integer condition in LHS part of rule file it is working fine.
For example: <eval> beanObject.getNumber >= 60 </eval>
but when using string condition in LHS part of the rule file, it is able to
filter the data when setting and getting the data from the dummy bean, but
not able to filter the data when the data is coming from the database its
throwing the exceptions like this.
For Example: <eval> beanObject.getName()</eval>
Exception like this.
org.drools.RuntimeDroolsException: java.lang.NullPointerException
at org.drools.rule.EvalCondition.isAllowed (Unknown Source)
at org.drools.reteoo.EvalConditionNode.assertTuple(Unknown Source)
at org.drools.reteoo.TupleSource.propagateAssertTuple(Unknown Source)
at org.drools.reteoo.JoinNode.assertObject (Unknown Source)
at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown
Source)
at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source)
at org.drools.reteoo.Rete.assertObject (Unknown Source)
at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)
at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown
Source)
at org.drools.common.AbstractWorkingMemory.assertObject (Unknown
Source)
at org.drools.common.AbstractWorkingMemory.assertObject(Unknown
Source)
at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown
Source)
at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown
Source)
at rules1.TestRuleForXML.applyRuleTestingProcessVO(
TestRuleForXML.java:176)
at rules1.TestRuleForXML.applyForProcessVO(TestRuleForXML.java:55)
size of the ouput list in java file: 0
at rules1.TestRuleForXML.main(TestRuleForXML.java:47)
Caused by: java.lang.NullPointerException
at rules1.Rule_my_rule_0.eval0(Rule_my_rule_0.java:12)
at rules1.Rule_my_rule_0Eval0Invoker.evaluate(Rule_my_rule_0Eval0Invoker.java:19)
If you do a help regarding how to work with String condition in LHS part, it
will be great..
Thanks in Advance,
Mahantesh.
17 years, 11 months
RE: [rules-users] java.lang.NoSuchMethodError
by shilpa.raghavendra@wipro.com
Thank you very much Steve its working fine.
I need one clarification in drl file. Here I am checking the two
values, the first value is from Numbers calss "one" and another is 2
which is constant
Is there any constraint the right side condition will take only constant
value like numeric or final filed in the class etc.
rule "check less"
no-loop true
when
n : Numbers( one < 2)
then
System.out.println( "One Less then Two" );
n.setResult(n.getOne()+n.getTwo());
System.out.println(n.getResult());
end
The situation like as follows I need to check two fields in the class.
Sample rule is given below
rule "check less"
no-loop true
when
n : Numbers( one < two)
then
System.out.println( "One Less then Two" );
n.setResult(n.getOne()+n.getTwo());
System.out.println(n.getResult());
end
Here one and two are the two fields in the class Numbers so here I am
comparing two fields so I got like this error
org.drools.rule.InvalidRulePackage: Unable to return Declaration for
identifier 'two'
at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
at com.sample.AddDroolsTest.readRule(AddDroolsTest.java:66)
at com.sample.AddDroolsTest.main(AddDroolsTest.java:22)
How to resolve it?
Thanks & Regards
Shilpa
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven
Williams
Sent: Monday, January 29, 2007 10:20 AM
To: Rules Users List
Subject: Re: [rules-users] java.lang.NoSuchMethodError
Sorry Shilpa - I was looking at 3.0.5. What I said still holds true
though - make sure the v642 jar is at the top of your runtime classpath.
On 1/29/07, shilpa.raghavendra(a)wipro.com <shilpa.raghavendra(a)wipro.com>
wrote:
I am using org.drools.ide_3.0.4 as eclipse plug-in it's having
org.eclipse.jdt.core_3.2.0.v_642.jar
Still I have to use higher version
Regards
Shilpa
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven
Williams
Sent: Monday, January 29, 2007 9:15 AM
To: Rules Users List
Subject: Re: [rules-users] java.lang.NoSuchMethodError
Hi Shilpa,
It looks like you do not have org.eclipse.jdt.core_3.2.0.v_671.jar in
your classpath. You should find it in the eclipse/plugins directory -
just add it to your application's classpath.
cheers
Steve
On 1/29/07, shilpa.raghavendra(a)wipro.com <shilpa.raghavendra(a)wipro.com >
wrote:
I am new to Drools. I wanted to put the rules in the project so I am
learning this.
So I have taken code sample from Maven Repository bur I am getting
following error.
To run the Example I Have used eclipse as IDE and the drl file in XML
format.
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/e
clipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(Ecli
pseJavaCompiler.java:237 )
at org.eclipse.jdt.internal.compiler.Compiler.compile(
Compiler.java:454 )
at org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(
EclipseJavaCompiler.java:268 )
at org.drools.compiler.PackageBuilder.compileAll(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at org.drools.examples.HonestPoliticianExample.main(
HonestPoliticianExample.java:20 )
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/e
clipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(Ecli
pseJavaCompiler.java:237 )
at org.eclipse.jdt.internal.compiler.Compiler.compile(
Compiler.java:454 )
at org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(
EclipseJavaCompiler.java:268 )
at org.drools.compiler.PackageBuilder.compileAll(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at org.drools.examples.HonestPoliticianExample.main(
HonestPoliticianExample.java:20 )
Exception in thread "main"
Please help me fix this.
Thanks in advance
Thanks & Regards
Shilpa
The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
www.wipro.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
www.wipro.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 11 months
RE: [rules-users] java.lang.NoSuchMethodError
by shilpa.raghavendra@wipro.com
I am using org.drools.ide_3.0.4 as eclipse plug-in it's having
org.eclipse.jdt.core_3.2.0.v_642.jar
Still I have to use higher version
Regards
Shilpa
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven
Williams
Sent: Monday, January 29, 2007 9:15 AM
To: Rules Users List
Subject: Re: [rules-users] java.lang.NoSuchMethodError
Hi Shilpa,
It looks like you do not have org.eclipse.jdt.core_3.2.0.v_671.jar in
your classpath. You should find it in the eclipse/plugins directory -
just add it to your application's classpath.
cheers
Steve
On 1/29/07, shilpa.raghavendra(a)wipro.com <shilpa.raghavendra(a)wipro.com
<mailto:shilpa.raghavendra@wipro.com> > wrote:
I am new to Drools. I wanted to put the rules in the project so I am
learning this.
So I have taken code sample from Maven Repository bur I am getting
following error.
To run the Example I Have used eclipse as IDE and the drl file in XML
format.
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/e
clipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(Ecli
pseJavaCompiler.java:237 )
at org.eclipse.jdt.internal.compiler.Compiler.compile(
Compiler.java:454)
at org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(
EclipseJavaCompiler.java:268)
at org.drools.compiler.PackageBuilder.compileAll(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at org.drools.examples.HonestPoliticianExample.main(
HonestPoliticianExample.java:20)
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/e
clipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(Ecli
pseJavaCompiler.java:237 )
at org.eclipse.jdt.internal.compiler.Compiler.compile(
Compiler.java:454)
at org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(
EclipseJavaCompiler.java:268)
at org.drools.compiler.PackageBuilder.compileAll(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at org.drools.examples.HonestPoliticianExample.main(
HonestPoliticianExample.java:20)
Exception in thread "main"
Please help me fix this.
Thanks in advance
Thanks & Regards
Shilpa
The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
www.wipro.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 11 months
java.lang.NoSuchMethodError
by shilpa.raghavendra@wipro.com
Hi,
I am using org.drools.ide_3.0.4 as eclipse plug-in it's
having the jar what you have mentioned.
Still I am getting that error.
Regards
Shilpa
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 11 months
java.lang.NoSuchMethodError
by shilpa.raghavendra@wipro.com
I am new to Drools. I wanted to put the rules in the project so I am
learning this.
So I have taken code sample from Maven Repository bur I am getting
following error.
To run the Example I Have used eclipse as IDE and the drl file in XML
format.
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/e
clipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(Ecli
pseJavaCompiler.java:237)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:454)
at
org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJava
Compiler.java:268)
at org.drools.compiler.PackageBuilder.compileAll(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at
org.drools.examples.HonestPoliticianExample.main(HonestPoliticianExample
.java:20)
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/e
clipse/jdt/core/compiler/CategorizedProblem;
at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(Ecli
pseJavaCompiler.java:237)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:454)
at
org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJava
Compiler.java:268)
at org.drools.compiler.PackageBuilder.compileAll(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at
org.drools.examples.HonestPoliticianExample.main(HonestPoliticianExample
.java:20)
Exception in thread "main"
Please help me fix this.
Thanks in advance
Thanks & Regards
Shilpa
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 11 months
Null Pointer Exception
by shilpa.raghavendra@wipro.com
Hi,
I am using eclipse IDE for Drools.
I am new to Drools so just trying adding to numbers if they
are other then zero, but I am getting Null Pointer Exception .
rule add
salience 10
when
a1 : AddNumber ( op1 != 0 )
a2: AddNumber ( op2 != 0 )
then
a1.setResult( a1.getOp1() + a2.getOp2() );
System.out.println( "Result is "+a1.getResult());
End
Regards
Shilpa
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
17 years, 11 months
RE: [rules-users] RE: Why not retracting?
by Anstis, Michael (M.)
Thanks Jeff - I guess Rules Engines were common New Years resolution
(I'm about 2 weeks in too) ;-)
I understood that the LHS side was operated upon when Facts were
asserted which, I think, creates the RHS Activation in the Agenda.
However I also thought that if the RHS modified Facts in the Working
Memory (by retracting, asserting or modifying them) the "Two Phase
Execution" (Agenda, Section 1.6.5) reassessed which rules needed
"firing" (activation?) and hence some of the "Cost - calculate cost for
'Stamping process' on a process" rules (in my example below) would be
disposed of. Is the activation not being dropped (perhaps because the
"machine == ( m )" condition is still met all be it that the Price to
which it relates as been disposed of?). I thought we were encouraged to
write rules that didn't need to be ran in any particular order whereas I
now find myself having to run some before others?
I'm not ranting at you Jeff, I'm just confused.
Cheers,
Mike
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Grimshaw,
Jeffrey
Sent: 26 January 2007 16:34
To: Rules Users List
Subject: RE: [rules-users] RE: Why not retracting?
Hi Michael. I've only been using JBoss Rules for about 2 weeks,
so keep that in mind when reading my reply.
The way I understand it works is that facts are evaluated
against the LHS of all the rules in the ruleset as they are asserted.
That is, when a fact is added to the WorkingMemory, the engine
determines which rules apply to that fact. You may expect that
evaluation to take place when the rules are "run". This may have
something to do with the behavior you are seeing.
For more info on what I'm talking about, see section 1.6.4.2 of
the user docs.
http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do
cs/3.0.5/html/index.html
Cheers,
--Jeff
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Friday, January 26, 2007 8:08 AM
To: Rules Users List
Subject: [rules-users] RE: Why not retracting?
By way of an update; if the retraction is made within a
different Agenda Group the rules work as expected.
However the problem of the retraction having no obvious affect
when operated within the same Agenda Group remains.
Is this a bug?
_____________________________________________
From: Anstis, Michael (M.)
Sent: 26 January 2007 11:32
To: 'Rules Users List'
Subject: Why not retracting?
Hello,
I have the following rules; one removes "Prices" that do
not have the required "Economic Level" from working memory, the other
calculates a "Costs":-
rule "Cost - remove prices that do not have the
required 'Economic Level'"
agenda-group "stamping-costs"
//salience 1
when
p : Price ( economicLevel != (
Utilities.makeDate(1, 1, 2007) ) )
then
System.out.println("Retracting
"+p.toString());
retract(p);
end
rule "Cost - calculate cost for 'Stamping
process' on a process"
agenda-group "stamping-costs"
//salience 2
when
r : ResourceEntry ( m : machine )
//p : Price ( economicLevel == (
Utilities.makeDate(1, 1, 2007) ), machine == ( m ) )
p : Price ( machine == ( m ) )
then
Cost cost = new Cost(r, p);
cost.setCost((float) (r.getUsage() *
p.getRate()));
assert(cost);
end
The problem is that the "Cost" rule still works upon ALL
"Prices" (even those with an incorrect "Economic Level").
If I change the line in the "Cost" rule to also check
the "Economic Level" the rules work as expected (i.e. "Costs" are only
calculated using "Prices" with an "Economic Level" of 01/01/2007).
I've tried using "salience" levels too (as commented in
the above Rules) but this doesn't have any effect either.
What am I doing wrong?
Cheers,
Mike
17 years, 11 months