Drools Debugging
by Veera
Hi All,
I have one doubt that is : When i compiling a sample HelloWorld Drools
program it is printing output like :
Hello World
Goodbye cruel world
and i added a simple rule like :
rule "test"
when
eval(true)
then
System.out.println( "Hello!!!" );
end
When i compile the output is :
Hello!!!
Hello World
Goodbye cruel world
But when i debug it is showing output like:
Hello World
Goodbye cruel world
Hello!!!
Can anybody help me how to get the same output when i debug also...
Regards,
Veera
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Debugging-tp3728574p3728574.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
declared variables in rules loaded to the same knowledge base
by Salina Fung/UFL - ICIL
We have 2 rules - rule 1 and rule 2, both have
declared variable @role(event)
In the program with statements to define the rule
<<
String rule1 = "package test001 import com.icil.event.*; declare EventImpl
@role(event) end rule \"test 001\" when Integer() then
System.out.println(\"rule test 001: there is an integer\"); end ";
String rule2 = "package test002 import com.icil.event.*; declare EventImpl
@role(event) end rule \"test 002\" when Integer() then
System.out.println(\"rule test 002: there is an integer\"); end ";
>>
and then try to load these two into the same knowledge base using Drools 5.3,
will get an runtime exception. But Drools 5.2, this is ok, with
no error.
Then in Drools 5.2
We try to print the address of the variable 'event' in the RHS of both rules, the
address is the same in both rules, which means they are sharing the same instance?
Is it the declared variables with the same name in separate
rules being loaded in the same knowledge base, will just
have ONE instance?
Thanks
Salina
12 years, 10 months
Can I change the value of a global in a rule consequence?
by Shur, Bob
The manual says "It is strongly discouraged to set or change a global value from inside your rules..." but it doesn't say it won't work.
I tried this:
========================
global Integer m;
declare DoneInit end
rule "init"
when
then
insert(new DoneInit());
System.out.println("m from Java: " + m);
m = 100;
System.out.println("m modified in init: " + m);
end
rule "use it"
when
DoneInit()
then
System.out.println("use m: " + m);
end
==========================
and got this output:
m from Java: 13
m modified in init: 100
use m: 13
Is this the expected behavior? I'm in a stateless session in case that matters.
12 years, 10 months
Unable to save or validate facts in Guvnor
by arup
Hi,
I can't save or validate any facts or pojo models in my guvnor. The guvnor
console is coming and i can browse through it but when i'm trying to save or
validate any items i'm getting some errors as below. Is there any repository
related problem??... how can i solve it??
0000039 SystemErr R Exception in thread "pool-1-thread-1"
java.lang.AbstractMethodError:
org/drools/repository/UserInfo$Command.process(Ljava/lang/String;)V
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
org.drools.repository.UserInfo.eachUser(UserInfo.java:179)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
org.drools.guvnor.server.repository.MailboxService.processOutgoing(MailboxService.java:81)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
org.drools.guvnor.server.repository.MailboxService$3.run(MailboxService.java:127)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
java.lang.Thread.run(Thread.java:810)
[2/8/12 13:56:49:155 IST] 0000003a SystemErr R Exception in thread
"pool-1-thread-2" java.lang.AbstractMethodError:
org/drools/repository/UserInfo$Command.process(Ljava/lang/String;)V
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
org.drools.repository.UserInfo.eachUser(UserInfo.java:179)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
org.drools.guvnor.server.repository.MailboxService.processOutgoing(MailboxService.java:81)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
org.drools.guvnor.server.repository.MailboxService$1.run(MailboxService.java:67)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
java.lang.Thread.run(Thread.java:810)
--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-save-or-validate-facts-in-Guv...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Option Call method on object
by nada1985
Hello
I started on Drools guvnor and I have to create business rules in the
interface Guvnor.J 'have imported the model jar containing the necessary
objects but I have a problem calling methods, and getters setteres of a
class.
When I defined the conditions in When section, and I go to action, I choose
Call method on Command, I do not see the methods of the Command class.
Have you any idea? It blocks me for many days I do not know where does the
problem.
thank you
--
View this message in context: http://drools.46999.n3.nabble.com/Option-Call-method-on-object-tp3726315p...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Rule processing blocking when I/O is involved in a BPMN 2.0 Task
by Alberto R. Galdo
Hi,
Our setup consists on some BPMN process being executed when a rule
fires. Our process has a node of type Task for which a handler is available
at the knowledge session. Our handler invokes a web service and waits (
blocks ) for the response before completing the task and letting the BPMN
process continue.
Well, we've inserted a hundred facts in the session that trigger the
rule that triggers the BPMN process that triggers the web service call ...
what we are seeing ( using the statistics gathered using JMX and our own
experience ) is that 100 rule activations are created and only one fires,
the rest, are "waiting" for the web service to respond. When the web
service responds then another rule fires, and so on. For an iliterate point
of view, seems that there's only one thread for it all, drools expert,
fusion and flow ...
Our session is stateful and we this is how we manage our session:
new Thread(new Runnable() {
public void run() {
session.fireUntilHalt();
}
}).start();
How do we get the rules to fire in parallel? Is there any better way
to get this done ( to get the processes executed in parallel and not
blocking the execution of the rules)?
Greets,
Alberto R. Galdo
argaldo(a)gmail.com
12 years, 10 months
5.3 ruleflow question
by St. Lawrence, Zachary
I am trying to use ruleflows to test a different approach to a problem but I am having problems finding the right implementing jars for use in my maven imports.
In 5.2 the needed builder classes were in jbpm-flow-builder. But 5.3 doesn't have that package. How does one use ruleflows in the most recent release of drools?
Zack
12 years, 10 months
DSL Build Problem
by John Peterson
I'm looking for a little help on a problem we can't figure out with some DSL errors during a build. We're working with version 5.3.0.Final on RSA 7.5.5.
The offending line of DSL is on the rule is:
Write qualifyingPoints on Result as $var01 * $var02
$var01 and $var02 are variables set in the WHEN part of this rule.
The offending line of code is translating to:
modify (Result){qualifyingPoints = $var01 * $var02};
When I execute the program that calls this rule, if fails during the build process with the following:
Unable to Analyse Expression @Modify with (Result){qualifyingPoints = $var01 * $var02 };
[Error: java/lang/String.isEmpty()Z]
[Near : {... @Modify with (Result){qualifyingPt ....}]
^
[Line: 1, Column: 9] : [Rule name=Qualifying Points rule 1']
If I modify the code to use an assignment and update instead of modify, it will build without an error:
Result.setQualifyingPoints( $var01 * $var02 );update (Result);
Note that we only see this behavior on RSA. We do not see it on Eclipse (but we need to use RSA).
I didn't find anything online so I thought I'd check to see if this is something someone has seen before.
Thanks!
12 years, 10 months
Can I insert a fact from within a drl function?
by Shur, Bob
It seems I am unable to insert a new fact from within a drl function. I tried this:
////////////////////////
package com.sample
declare Dummy
end
function void init() {
insert(new Dummy()); // Doesn't compile
}
rule "init"
salience 999
when
then
init();
insert(new Dummy()); // Compiles
end
////////////////////////
Is the above supposed to work?
12 years, 10 months