4.0 JBoss Rules IDE - JDK 1.4 compiler setting
by Ronald R. DiFrango
All,
I had to change the compiler setting from JDK 5.0 to JDK 1.4 and no all of a
sudden my DRL files give me the following error:
Severity and Description Path Resource Location Creation Time
Id
Syntax error, static imports are only available if source level is 5.0
RtvDecisionEngine/src/rules/com/circuitcity/rtvcrms/rules
modelDiscrepancyRules.drl line 20 1184006663382 77860
On all rules.
Thoughts?
Ron
17 years, 6 months
Having an else part
by Natraj Gudla
When writing a rule, how do i deal with a scenario to do an action when a
condition is not true. If i have a business need like
IF COND1 is true
DO Action1
ELSE
DO Action 2
I feel with drools we only check for the condition in when part and incase
it fails, we dont have a way to call another action. Any idea??
Thanks
Natraj
17 years, 6 months
Re: [rules-users] simple rule with global var causing errors.
by Edson Tirelli
Can you wrap that in a zip so I can investigate here?
We have tests for the use of globals, so they work fine... not sure why
you are having problems.
[]s
Edson
2007/7/16, Mike Vargo <mike.vargo(a)chromeriver.com>:
>
> It is in the same package…
>
>
>
> *From:* rules-users-bounces(a)lists.jboss.org [mailto:
> rules-users-bounces(a)lists.jboss.org] *On Behalf Of *Edson Tirelli
> *Sent:* Monday, July 16, 2007 4:35 PM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] simple rule with global var causing errors.
>
>
>
>
> Is the RulesOutput class in the com.sample package? otherwise you need
> to either fully qualify the class name or import it...
>
> []s
> Edson
>
> 2007/7/16, Mike Vargo < mike.vargo(a)chromeriver.com>:
>
> *I have a very simple drl file.*
>
>
>
> ==============================================
>
> package com.sample;
>
> #generated from Decision Table
>
> global RulesOutput rulesOutput;
>
> #From row number: 12
>
> rule "Routing Decision_12"
>
>
>
> salience 65524
>
> when
>
> Matter(type == "MyMatter")
>
> then
>
> rulesOutput.setRoleId(1);
>
> drools.clearAgenda();
>
> end
>
> ==============================================
>
>
>
> *When I load it, I get the following:*
>
>
>
> org.drools.rule.InvalidRulePackage: Rule Compilation error rulesOutput
> cannot be resolved
>
>
>
> at org.drools.rule.Package.checkValidity(Unknown Source)
>
> at org.drools.common.AbstractRuleBase.addPackage(Unknown
> Source)
>
> at com.sample.PHRulesTest.main(PHRulesTest.java:42)
>
>
>
> Any help is appreciated…
>
>
>
> - Mike
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
17 years, 6 months
Re: [rules-users] simple rule with global var causing errors.
by Edson Tirelli
Is the RulesOutput class in the com.sample package? otherwise you need to
either fully qualify the class name or import it...
[]s
Edson
2007/7/16, Mike Vargo <mike.vargo(a)chromeriver.com>:
>
> *I have a very simple drl file.*
>
>
>
> ==============================================
>
> package com.sample;
>
> #generated from Decision Table
>
> global RulesOutput rulesOutput;
>
> #From row number: 12
>
> rule "Routing Decision_12"
>
>
>
> salience 65524
>
> when
>
> Matter(type == "MyMatter")
>
> then
>
> rulesOutput.setRoleId(1);
>
> drools.clearAgenda();
>
> end
>
> ==============================================
>
>
>
> *When I load it, I get the following:*
>
>
>
> org.drools.rule.InvalidRulePackage: Rule Compilation error rulesOutput
> cannot be resolved
>
>
>
> at org.drools.rule.Package.checkValidity(Unknown Source)
>
> at org.drools.common.AbstractRuleBase.addPackage(Unknown
> Source)
>
> at com.sample.PHRulesTest.main(PHRulesTest.java:42)
>
>
>
> Any help is appreciated…
>
>
>
> - Mike
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
17 years, 6 months
simple rule with global var causing errors.
by Mike Vargo
I have a very simple drl file.
==============================================
package com.sample;
#generated from Decision Table
global RulesOutput rulesOutput;
#From row number: 12
rule "Routing Decision_12"
salience 65524
when
Matter(type == "MyMatter")
then
rulesOutput.setRoleId(1);
drools.clearAgenda();
end
==============================================
When I load it, I get the following:
org.drools.rule.InvalidRulePackage: Rule Compilation error rulesOutput
cannot be resolved
at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown
Source)
at com.sample.PHRulesTest.main(PHRulesTest.java:42)
Any help is appreciated.
- Mike
17 years, 6 months
4.0.M1 JBoss Rules IDE - Unknown error
by Ronald R. DiFrango
I am getting the following error and I have no way of trackign down where it
is occurring and how to correct it:
Severity and Description Path Resource Location Creation Time
Id
Trying to create a restriction for an empty restriction list
RtvDecisionEngine/src/rules/com/circuitcity/rtvcrms/rules rtv.drl
Unknown 1184614547431 82053
17 years, 6 months
Another multi thread error
by Pierre Paysant-Le Roux
Hi,
I solved my first multi thread problem by having a shared RuleBase for
all threads. My problem is now with Objects insertion. Here is the trace
that occur :
java.lang.ArrayIndexOutOfBoundsException: 17
at
org.drools.util.AbstractHashTable$HashTableIterator.next(AbstractHashTable.java:250)
at org.drools.reteoo.Rete$ObjectTypeConf.buildCache(Rete.java:434)
at org.drools.reteoo.Rete$ObjectTypeConf.getObjectTypeNodes(Rete.java:425)
at org.drools.reteoo.Rete.assertObject(Rete.java:172)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:584)
at test.TestThreads$DroolsThread.run(TestThreads.java:65)
at java.lang.Thread.run(Thread.java:534)
The program that I made to reproduce this error create threads that each
create a working memory from a static rule base (that works great) and
then insert some objects in this working memory. I have this error in a
real j2ee program.
Here is a listing of the code :
package test;
import java.io.IOException;
import java.io.InputStreamReader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.compiler.DroolsParserException;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
public class TestThreads {
public static RuleBase rulebase;
public static void main(String[] args) {
PackageBuilderConfiguration pkgBuilderCfg =
new PackageBuilderConfiguration();
PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
try {
builder.addPackageFromDrl(new InputStreamReader(
TestThreads.class.getResourceAsStream( "Sample.drl" )));
} catch (DroolsParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
rulebase = RuleBaseFactory.newRuleBase();
try {
rulebase.addPackage(builder.getPackage());
} catch (Exception e) {
e.printStackTrace();
}
for(int i = 0; i<100 ; i++) {
DroolsThread tt = new DroolsThread("Thread " + i);
new Thread(tt).start();
}
}
public static class Fact {
public String s;
public Fact(String s){
this.s = s;
}
public String getS() {
return s;
}
}
public static class DroolsThread implements Runnable {
private String id;
public DroolsThread(String id) {
this.id = id;
}
public void run() {
StatefulSession session = rulebase.newStatefulSession();
for(int i = 0; i < 100; i++) {
session.insert(new Fact(id));
}
}
}
}
I am using Drools MR3.
Thanks for your help.
Pierre Paysant-Le Roux
17 years, 6 months
Re: [rules-users] Rule compilation errors under heavy load
by Andrew Thompson
>It's a good point about using yield(). I did use this originally, but
>for some reason it generated fewer errors than using some arbitrary
>sleep values.
>From discussions or reading I did years back I vaguely recall, yield() isn't required to do anything.
If the VM/OS observes that the same thread that called yield() is still eligible to run, it is quite likely to simply reschedule it as the best candidate.
Depending on the level in the code where this happens in a particular VM or OS implementation, yield() can therefore be a no-op, or a very short break.
sleep() on the other hand makes the thread ineligible to run for a period, forcing a context switch to always happen.
--
Andrew Thompson
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091
17 years, 6 months
RE: [rules-users] Rule compilation errors under heavy load
by Hehl, Thomas
Yeah, me either. Welcome to Java!:)
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Dean Jones
Sent: Monday, July 16, 2007 9:09 AM
To: Rules Users List
Subject: Re: [rules-users] Rule compilation errors under heavy load
Hi Thomas,
On 7/16/07, Hehl, Thomas <Thomas.Hehl(a)acs-inc.com> wrote:
> Couldn't you use yield() to generate a context-switch? It would only
happen
> in that spot, but should produce some good testing.
>
It's a good point about using yield(). I did use this originally, but
for some reason it generated fewer errors than using some arbitrary
sleep values. At the time, I explained this to myself as follows:
yield() means that context switching happens at well-defined points,
whereas when there are lots of sleeping threads waking up at arbitrary
moments wanting to be run, context switching happens more randomly.
I'm not sure if this explanation makes complete sense, though.
Dean.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
17 years, 6 months
RE: [rules-users] Rule compilation errors under heavy load
by Hehl, Thomas
Couldn't you use yield() to generate a context-switch? It would only happen
in that spot, but should produce some good testing.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Dean Jones
Sent: Monday, July 16, 2007 5:48 AM
To: Rules Users List
Subject: Re: [rules-users] Rule compilation errors under heavy load
On 7/14/07, Mark Proctor <mproctor(a)codehaus.org> wrote:
> We are going to need an integration test, to reproduce this, can you
> supply one?
>
Okay, I've just converted the simple test that I added earlier to a
Junit test. The test is not guaranteed to fail if there are thread
safety errors, just very likely to fail (don't know if this is
acceptable for you). Initially, I wrote a test which guaranteed that
calls to the addPackage() and getPackage() methods were interleaved by
different threads, but, annoyingly, this test passed. It seems that a
context-switch halfway through one of these methods is necessary to
provoke the problem (which is difficult to guarantee :-)
Dean.
17 years, 6 months