HelloWorld Example for drools4MR3
by Joshua Jackson
Hi all,
I tried the HelloWorld example in drools4MR3 but it doesnt work since
there no assertObject method for StatefulSession class ->
session.assertObject( message );
What do I write in order to get this example and other examples working?
Thanks in advance
--
It's not just about coding, it's a matter of fulfilling you core being
YM!: thejavafreak
Blog: http://joshuajava.wordpress.com/
17 years, 5 months
NullPointerException while deleting the rule package
by Sarika Khamitkar
Sorry for resending the message. This is an urgent issue and if anybody
has encountered this problem, can you please let me know how it can be
resolved?
If I have over 3 packages in the RuleBase and I try to remove one of
those packages, then I get a NullPointerException.
Thanks.
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Sarika
Khamitkar
Sent: Wednesday, July 11, 2007 3:34 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] NullPointerException while deleting the rule
package
Hi,
I am trying a remove a rule from the RuleBase using the following syntax
and get a NullPointerException:
ruleBase.removePackage("rule2392016206");
Before removing the package, I am iterating through all the packages in
the ruleBase and I can see this package name in the list. I am not sure
why this exception is being thrown then.
I am using 4.0 MR3.
Has this feature changed since 3.0.6?
Thanks.
Sarika
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
17 years, 5 months
NullPointerException while deleting the rule package
by Sarika Khamitkar
Hi,
I am trying a remove a rule from the RuleBase using the following syntax
and get a NullPointerException:
ruleBase.removePackage("rule2392016206");
Before removing the package, I am iterating through all the packages in
the ruleBase and I can see this package name in the list. I am not sure
why this exception is being thrown then.
I am using 4.0 MR3.
Has this feature changed since 3.0.6?
Thanks.
Sarika
17 years, 5 months
Multi thread error
by Pierre Paysant-Le Roux
Hi,
I have a problem using Drools in a multi thread program. I want that
several threads use there own working memory. There is an error when two
thread are building the same PackageBuilder at the same time. The
exception is: java.lang.LinkageError: duplicate class definition.
Here is a simple program that generates the error.
package com.sample;
import java.io.IOException;
import java.io.InputStreamReader;
import org.drools.compiler.DroolsParserException;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
public class TestThreads {
public static void main(String[] args) {
for(int i = 0; i<2 ; i++) {
DroolsThread tt = new DroolsThread();
tt.start();
}
}
public static class DroolsThread extends Thread {
public void run() {
PackageBuilderConfiguration pkgBuilderCfg =
new PackageBuilderConfiguration();
PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
try {
builder.addPackageFromDrl(new
InputStreamReader(DroolsTest.class.getResourceAsStream( "/Sample.drl" )));
} catch (DroolsParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
I don't understand what to do to avoid the exception : using
"synchronized" somewhere ? Can someone help me please ?
Thanks
Pierre
17 years, 5 months
RE: org/drools/StatefulSession
by Dion Dodgen
Hi,
I'm having a dependency issue using seam and drools. I have packaged
drools compiler and core 3.0.6 with seam which brought this issue to
light.
I have checked the jars and as always java is truthful.
Please could someone let me know the correct jars and dependencies to
package with seam 2.0 and where to find them.
Thanks
Dion
17 years, 5 months
Set of rules needs to be executed based on some condition
by Ashwini Joshi
Hi,
We have a requirement that each set of rules is associated with a schedule
that defines when this rule needs to be executed.
So I need to check whether date, time and week matches and only then execute
the set of rules. I don't want to check the schedule for each rule. I want
to do it only once for each set of rule. What feature of rules engine can I
use for this?
Thanks,
Ashwini
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
17 years, 5 months
ClassCastException caused by generated java code?!
by Krister Saleck
Hi,
thanks for the new features in 4.0MR3 - now i may get rid
of some of my workarounds :-)
Unfortunately one problem still pops up in MR3:
Some generated code causes a ClassCastException while casting to
a implementation class. Because JBossRules wraps Facts by a generated
class implementing the facts interface, there should only be some
casting to the interface class?!
---
caused by: java.lang.ClassCastException: de.myToys.CallContextImpl
at
de.myToys.konsum.core.account.rules.Rule_Buyer_neutral_0Eval0Invoker.eva
luate(
Rule_Buyer_neutral_0Eval0Invoker.java:12)
at
org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:71)
---
rule "Buyer neutral"
when
$c : CallContext(cause == "checkout", state == "new")
$order : Order()
(Quality(value == 1) or Quality(value == 2))
eval($order.getBuyer().isProspect())
then
$c.setState("neutral");
end
---
If I execute the rule without the "or" term i do not run into
that problem.... bad rule style?
Did anyone have a hint?
Thanks in advance,
Krister
17 years, 5 months
How to create binary package
by Barfield Steve
Is Package.writeExternal(ObjectOutput) the best way to create a binary file of your package that can be read by BinaryRuleBaseLoader.addPackage(InputStream) ?
Having generated a package using standard code, I've tried to create a binary file of the package for deployment as below.
But when BinaryRuleBaseLoader reads the binary file it raises :
Can only add instances of org.drools.rule.Package to a rulebase instance.
Looking inside the binary file I can see it doesn't have the first line :
’__sr__org.drools.rule.Package_______@
which is found in packages downloaded from JBRMS. So this code isn't quite working. Please can you help.
builder.addPackageFromDrl(source);
Package pkg = builder.getPackage();
try{
FileOutputStream tempFile = new
FileOutputStream("my.pkg");
ObjectOutput oos = new ObjectOutputStream(tempFile);
pkg.writeExternal(oos);
oos.flush();
oos.close();
tempFile.flush();
tempFile.close();
}
catch(Exception e){
System.out.println(e.toString());
}
Regards, Steve Barfield, Developer
Application Services
FUJITSU SERVICES
Cavendish Road, Stevenage, Herts, SG1 2DY
* +44 (0) 870 234 8197 (Int: 7444 8197)
* +44 (0) 7867 828474
* <mailto:steve.barfield@uk.fujitsu.com <mailto:steve.barfield@uk.fujitsu.com> >
Web: http://uk.fujitsu.com <http://uk.fujitsu.com/>
Fujitsu Services Limited, Registered in England no 96056, Registered Office 22 Baker Street, London, W1U 3BW
This e-mail is only for the use of its intended recipient. Its contents are subject to a duty of confidence and may be privileged. Fujitsu Services does not guarantee that this e-mail has not been intercepted and amended or that it is virus-free.
17 years, 5 months