Can't upload model in BRMS
by Drouin.Mathieu
I can't seem to upload a model into the BRMS. I also tried downloading
and uploading the model in the insurance example and it failed. (I tried
both the .war on tomcat 6.0.13 and the standalone version on tomcat
5.5.20).
Can somebody help?
Thanks,
Mat
17 years, 3 months
HELP - Error when accessing RuleAgent
by kissro@lidp.com
I've created the following rule in BRMS and deployed it -
rule "Underwriting Rule 1"
dialect "mvel"
when
p : Policy( premium < "50.00" )
then
p.setStatus( 32 );
end
I have the following code processing the rule -
public void main(Policy inputPolicy) throws Exception
{
RuleBase ruleBase = loadRuleBase();
StatefulSession session = ruleBase.newStatefulSession();
session.insert(inputPolicy);
session.fireAllRules();
}
private RuleBase loadRuleBase() throws IOException, Exception
{
RuleAgent agent = RuleAgent.newRuleAgent("/uwrules.properties");
RuleBase ruleBase = agent.getRuleBase();
return ruleBase;
}
When I run my application I get the following error. Could someone tell
me why or where to look to determine the reason? Do I have something
coded incorrectly?
Exception in thread "main" javax.ejb.EJBException:
java.lang.ClassCastException: java.util.HashSet
at
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
.
.
.
Caused by: java.lang.ClassCastException: java.util.HashSet
at org.drools.rule.Package.readExternal(Package.java:172)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:54)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:137)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:109)
at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)
at
org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:297)
at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:265)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:251)
at org.drools.agent.RuleAgent.init(RuleAgent.java:183)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:192)
17 years, 3 months
Can't access binary rules package in application
by kissro@lidp.com
Using BRMS, I created a rule binary package and downloaded it and am
trying to access it but I'm getting a NullPointerException. My code
looks like this -
public void main(Policy inputPolicy) throws Exception
{
RuleBase ruleBase = loadRuleBase();
StatefulSession session = ruleBase.newStatefulSession();
session.insert(inputPolicy);
session.fireAllRules();
}
private RuleBase loadRuleBase() throws IOException, Exception
{
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader();
loader.addPackage( this.getClass().getResourceAsStream(
"/underwriting.pkg" ) );
RuleBase ruleBase = loader.getRuleBase();
return ruleBase;
}
I'm getting the following error. Can someone tell me what I'm doing
wrong? Do I have something coded incorrectly?
Exception in thread "main" javax.ejb.EJBException:
java.lang.NullPointerException
at
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
.
.
.
Caused by: java.lang.NullPointerException
at
org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:105)
at
org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:67)
at
com.lidp.server.session.UnderwritingRule.loadRuleBase(UnderwritingRule.java:59)
at
com.lidp.server.session.UnderwritingRule.main(UnderwritingRule.java:20)
at
com.lidp.server.session.RuleProcessEngine.underwriting(RuleProcessEngine.java:42)
17 years, 3 months
probliem in using "in" and "not in" operator in drool file.
by Gaurav2007
Hi All,
I am using drool4.0.1 in my application,
I have one map in global memory this map contains mapping of id and value,i
want to validate these values.
but when i am using in and not in rule like:
eval(validatorMap.get("name") not in("amit","siddhartha"))
where validatorMap is a map of id and value inserted in global memory.
it is giving following error:
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=Short Name, agendaGroup=MAIN, salience=0, no-loop=false]
com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java (8:330) : The
left-hand side of an assignment must be a variable
com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java (8:357) :
Syntax error on token "not", invalid AssignmentOperator
please help me how to validate value from a map using in and not in operator
of drool.
Thanks.
--
View this message in context: http://www.nabble.com/probliem-in-using--%22in%22-and-%22not-in%22-operat...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Adding constraints to facts in DSL
by stephane.remillieux@agysoft.fr
Hello,
I'm using JBossDrools in my company and I have some problems with
DSL.
Actually, I would like to write something like this : There is a Cheese with
( - age is less than 42 or - age is more than 60 )
- type is 'stilton' Unfortunately, It's the drools parser
which manage "-" char. Also this previous synthax don't work in the
LHS.
Anyone could help me to do an equivalent condition in my DSL ? If
possible with "-" sugar char.
Stephane.PS : Sorry, for my very bad english.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
17 years, 3 months
RE: [rules-users] Ruleflow and persistence
by DELBART Vincent
I have really those results in the first set (I put a project in the forum)
If I put an update I loop...
With a no-loop it seems work... But I have the same result without my ruleflow.
vdelbart
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] De la part de Kris Verlaenen
Envoyé : lundi 10 septembre 2007 16:37
À : Rules Users List
Objet : Re: [rules-users] Ruleflow and persistence
The expected behavior is actually the second one, did you really get those results when executing the first set? The reason is that you should notify the engine if you change a product (so it can re-evaluate). Otherwise, it will never know that the product has changed price and will still use the old price. So you should add a update($p) statement after changing your product if you want the engine to take that change into account.
Kris
----- Original Message -----
From: "vdelbart" <delbart.v(a)mipih.fr>
To: <rules-users(a)lists.jboss.org>
Sent: Monday, September 10, 2007 4:17 PM
Subject: [rules-users] Ruleflow and persistence
>
> Hello,
>
> I have a problem with this ruleflow :
>
> http://www.nabble.com/file/p12593732/ruleflow.jpg
>
> This two rules package doesn't work in the same way :
>
> First package :
>
> #created on: 29 août 2007
> package reductionExample1
>
> import model.*
>
> rule "global rule"
> ruleflow-group "WorldReduction"
> #include attributes such as "salience" here...
> when
> $p:Product(year == 2006)
> then
> #actions
> System.out.println("Global rule");
> System.out.println("$p.getPrice() : " + $p.getPrice());
> $p.setPrice($p.getPrice()*1.1);
> end
> rule "local rule"
> ruleflow-group "StateReduction"
> #include attributes such as "salience" here...
> when
> $p:Product(year < 2007, $price: price)
> then
> #actions
> System.out.println("Local rule");
> System.out.println("$price : " + $price);
> System.out.println("$p.getPrice() : " + $p.getPrice());
> $p.setPrice($price * 1.2);
> end
>
> I have :
> Before : Product(name=Adidas, year=2006, price=100.0)
> Global rule
> $p.getPrice() : 100.0
> Local rule
> $price : 110.00000000000001
> $p.getPrice() : 110.00000000000001
> After : Product(name=Adidas, year=2006, price=132.0)
>
>
> Second package :
>
> #created on: 29 août 2007
> package reductionExample1
>
> import model.*
>
> rule "global rule"
> ruleflow-group "WorldReduction"
> #include attributes such as "salience" here...
> when
> $p:Product(year == 2006, $priceGlobal: price)
> then
> #actions
> System.out.println("Global rule");
> System.out.println("$price : " + $priceGlobal);
> System.out.println("$p.getPrice() : " + $p.getPrice());
> $p.setPrice($p.getPrice()*1.1);
> end
> rule "local rule"
> ruleflow-group "StateReduction"
> #include attributes such as "salience" here...
> when
> $p:Product(year < 2007, $price: price)
> then
> #actions
> System.out.println("Local rule");
> System.out.println("$price : " + $price);
> System.out.println("$p.getPrice() : " + $p.getPrice());
> $p.setPrice($price * 1.2);
> end
>
> I have :
>
> Before : Product(name=Adidas, year=2006, price=100.0)
> Global rule
> $price : 100.0
> $p.getPrice() : 100.0
> Local rule
> $price : 100.0
> $p.getPrice() : 110.00000000000001
> After : Product(name=Adidas, year=2006, price=120.0)
>
>
> What is the normal execution (for me the first way) and why is different ?
>
> thanks,
>
> vdelbart
>
> --
> View this message in context:
> http://www.nabble.com/Ruleflow-and-persistence-tf4415033.html#a12593732
> Sent from the drools - user mailing list archive at Nabble.com.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
17 years, 3 months
problems with BRMS
by Isabelle Hupont
Hi!
I'm running insurance example in the BRMS web interface with Tomcat, and it
works well. But when I try to create my own new rules or DSL language and
save them, I have a java.lang.ClassNotFoundException:
org.drools.brms.client.rpc.RuleAsset.
Is it a bug? Is there any problem using Tomcat?
--
View this message in context: http://www.nabble.com/problems-with-BRMS-tf4417023.html#a12598525
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
java.lang.ClassCastException error
by kissro@lidp.com
I have created a .drl file that contains the following rule:
rule "Underwriting Rule 1"
dialect "mvel"
when
p : Policy( premium < "50.00" )
then
p.setStatus( 32 );
end
The code below processes the rule:
public void main(Policy inputPolicy) throws Exception
{
RuleBase ruleBase = buildPackage();
StatefulSession session = ruleBase.newStatefulSession();
session.insert(inputPolicy);
session.fireAllRules();
}
private RuleBase buildPackage () throws IOException, Exception
{
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader(
UnderwritingRule.class.getResourceAsStream(
"/underwriting.drl" ) ) );
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( builder.getPackage() );
return ruleBase;
}
The code and rule above process just fine, without any errors.
Using the BRMS web interface, I've created a rule and compiled it into a
package. The rule created via BRMS looks like this:
rule "Underwriting Rule 1"
dialect "mvel"
when
p : Policy( premium < "50.00" )
then
p.setStatus( 32 );
end
I've deployed the rule package and the code below processes it:
public void main(Policy inputPolicy) throws Exception
{
RuleBase ruleBase = loadRuleBase();
StatefulSession session = ruleBase.newStatefulSession();
session.insert(inputPolicy);
session.fireAllRules();
}
private RuleBase loadRuleBase() throws IOException, Exception
{
RuleAgent.newRuleAgent("/brmsunderwritingrules.properties");
RuleBase ruleBase = agent.getRuleBase();
return ruleBase;
}
Now, when I run the above code, I get an error -
ERROR [STDERR] RuleAgent(default) INFO Configuring with
newInstance=true, secondsToRefresh=30
ERROR [STDERR] RuleAgent(default) INFO Configuring package provider :
DirectoryScanner scanning dir: \deployed\rules found 1
file(s).
INFO [STDOUT] Error - java.lang.ClassCastException: java.util.HashSet
In the 2nd sample of code, I'm using a rule package and am using the
RuleAgent to load the rule base but I don't know why I getting the
java.lang.ClassCastException error. Does anyone know why?
Rod
17 years, 3 months
Still can't create a standalone application
by MarkA
I'm close to giving up!
No matter what I do I get the noclassdeffound error. I can't get anything
that uses Drools to work outside of eclipse.
I've now tried using javac and I still get errors, the first is:
----------------------------------------------------------------------------------------------------------------
[javac] [search path for source files:
[/Users/mark/Documents/eclipse/drools-test-mini/src]]
[javac] [search path for class files: [... (lots of paths removed) ...
/Users/mark/Documents/eclipse/drools-test-mini/JAR
...]]
...
[javac]
/Users/mark/Documents/eclipse/drools-test-mini/src/com/mda/dt/DroolsTest.java:6:
package org.drools does not exist
[javac] import org.drools.RuleBase;
[javac] ^
----------------------------------------------------------------------------------------------------------------
But the directory '/Users/mark/Documents/eclipse/drools-test-mini/JAR' has
the following:
antlr-runtime-3.0.jar drools-compiler-4.0.1.jar
mvel14-1.2rc4rv908.jar xpp3_min-1.1.3.4.O.jar
core-3.2.3.v_686_R32x.jar drools-core-4.0.1.jar
xercesImpl-2.4.0.jar xstream-1.2.2.jar
drools-ant-4.0.1.jar jxl-2.4.2.jar
xml-apis-1.0.b2.jar
The org.drools.RuleBase is in the drools-core jar file so what is it that I
am doing wrong?
--
View this message in context: http://www.nabble.com/Still-can%27t-create-a-standalone-application-tf438...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Ruleflow and persistence
by vdelbart
Hello,
I have a problem with this ruleflow :
http://www.nabble.com/file/p12593732/ruleflow.jpg
This two rules package doesn't work in the same way :
First package :
#created on: 29 août 2007
package reductionExample1
import model.*
rule "global rule"
ruleflow-group "WorldReduction"
#include attributes such as "salience" here...
when
$p:Product(year == 2006)
then
#actions
System.out.println("Global rule");
System.out.println("$p.getPrice() : " + $p.getPrice());
$p.setPrice($p.getPrice()*1.1);
end
rule "local rule"
ruleflow-group "StateReduction"
#include attributes such as "salience" here...
when
$p:Product(year < 2007, $price: price)
then
#actions
System.out.println("Local rule");
System.out.println("$price : " + $price);
System.out.println("$p.getPrice() : " + $p.getPrice());
$p.setPrice($price * 1.2);
end
I have :
Before : Product(name=Adidas, year=2006, price=100.0)
Global rule
$p.getPrice() : 100.0
Local rule
$price : 110.00000000000001
$p.getPrice() : 110.00000000000001
After : Product(name=Adidas, year=2006, price=132.0)
Second package :
#created on: 29 août 2007
package reductionExample1
import model.*
rule "global rule"
ruleflow-group "WorldReduction"
#include attributes such as "salience" here...
when
$p:Product(year == 2006, $priceGlobal: price)
then
#actions
System.out.println("Global rule");
System.out.println("$price : " + $priceGlobal);
System.out.println("$p.getPrice() : " + $p.getPrice());
$p.setPrice($p.getPrice()*1.1);
end
rule "local rule"
ruleflow-group "StateReduction"
#include attributes such as "salience" here...
when
$p:Product(year < 2007, $price: price)
then
#actions
System.out.println("Local rule");
System.out.println("$price : " + $price);
System.out.println("$p.getPrice() : " + $p.getPrice());
$p.setPrice($price * 1.2);
end
I have :
Before : Product(name=Adidas, year=2006, price=100.0)
Global rule
$price : 100.0
$p.getPrice() : 100.0
Local rule
$price : 100.0
$p.getPrice() : 110.00000000000001
After : Product(name=Adidas, year=2006, price=120.0)
What is the normal execution (for me the first way) and why is different ?
thanks,
vdelbart
--
View this message in context: http://www.nabble.com/Ruleflow-and-persistence-tf4415033.html#a12593732
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months