Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:
by Pardeep.Ruhil@lntinfotech.com
Hi,
I am newbie to drools. I am facing the below exception when I m trying to
run my code through
Command Prompt.
I have set the all the jars in the xbootclasspath of my application , but
still I am getting the same exception.
I am able to run my application in eclipse , but the same when i run from
Command Prompt give me this exception.
Please help to get through the situation.
My exception is :
org.drools.RuntimeDroolsException: Unable to load dialect
'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java
:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)
at
org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:259)
at
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:176)
at
org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:153)
at
org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:242)
.
.
.
Caused by: java.lang.NullPointerException
at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:92)
at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)
at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:270)
Thanks & Regards
Pardeep Ruhil
L&T Infotech Ltd
Mumbai
Ph: +919820283884
Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com
This Document is classified as:
L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
Internal Use Only L&T Infotech General Business
This Email may contain confidential or privileged information for the
intended recipient (s) If you are not the intended recipient, please do
not use or disseminate the information, notify the sender and delete it
from your system.
______________________________________________________________________
15 years, 5 months
Help needed for a weird issue when firing an external event with Drools Expert and Flow
by kitc25
I have the the following rule,
rule "Validation"
ruleflow-group "Validation"
when
$tar : MyObject()
eval ($tar.validation() == true)
then
kcontext.getKnowledgeRuntime.signalEvent("ValidationError",
null);
end
Where ValidationError is an external event defined in Flow.
The problem I am having is if I defined the ValidationError event to be
external, the signalEvent will get called all the time, and something $tar
will become null when I try to print it out before the signalEvent call, but
if I defined the ValidationEvent to be internal everything works as
expected, but I just can't trigger the event because it is internal. Did I
do anything wrong? Thank you for your help in advance.
PS: I know I can trigger the internal event by passing the process object to
the session, then trigger the event with the process object, but I really
don't thnk this is a good design.
--
View this message in context: http://www.nabble.com/Help-needed-for-a-weird-issue-when-firing-an-extern...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
Re: [rules-users] Problem calling a function returning String
by Greg Barton
In general the use of static method calls in conditions when the return values could change is not recommended. Things can get wiggy, as you've already seen.
The rule conditions are evaluated when the objects they match on are inserted into working memory. In your case, though, the rule doesn't match on any object, so the condition evaluates when the session is created. (That's my guess, at least.) It's NOT when you call fireAllRules. That only tells the session to fire rules that are currently eligible to fire. So, if your sequence is this, nothing will happen:
<make session>
ValidationUtilities.evaVersionsNr = "1234";
fireAllRules()
However, this might work:
ValidationUtilities.evaVersionsNr = "1234";
<make session>
fireAllRules()
But, even if it does, it's not a good idea. There's basically no way to inform the engine that ValidationUtilities.evaVersionsNr has changed, so your results could be unpredictable. (Especially as ValidationUtilities.evaVersionsNr is a public static member. Oi!)
--- On Tue, 7/7/09, rainbowflower <al_aysha(a)yahoo.co.in> wrote:
> From: rainbowflower <al_aysha(a)yahoo.co.in>
> Subject: [rules-users] Problem calling a function returning String
> To: rules-users(a)lists.jboss.org
> Date: Tuesday, July 7, 2009, 10:33 AM
>
> Hi all,
>
> I am rather new to Drools and I have a problem using
> functions.
>
> I have a rule like:
>
> rule "rule 1"
> when
>
> eval(getEVAVersionsNr() == "1234")
> then
>
> System.out.println("rule fired");
> end
>
> The getEVAVersionsNr() method is present in a Java class
> "ValidationUtilities.java", which I'm importing in my drl
> file and it looks
> like this:
>
> public class ValidationUtilities {
>
> public static String evaVersionsNr;
>
> public static String getZEVAVersionsNummer()
> {
> return evaVersionsNr;
> }
> }
>
> This static attribute "evaVersionsNr" is set to "1234" from
> another Java
> class before I fire my rules. So, I assume that the eval
> construct should
> return true. But, it does not return true and the
> consequence is not
> exected.
>
> Further info:
>
> When I modify my rule like:
>
> rule "rule 1"
> when
> eval(true)
> then
>
> System.out.println(getEVAVersionsNr());
> end
>
> the consequence part is getting executed and 1234 is
> getting printed.
>
> I am really lost and I could not find out what goes wrong.
> If someone could
> find out what I am missing, I shall be thankful.
>
> Thanks in advance.
> --
> View this message in context: http://www.nabble.com/Problem-calling-a-function-returning-String-tp24375...
> 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
>
15 years, 5 months
Problem calling a function returning String
by rainbowflower
Hi all,
I am rather new to Drools and I have a problem using functions.
I have a rule like:
rule "rule 1"
when
eval(getEVAVersionsNr() == "1234")
then
System.out.println("rule fired");
end
The getEVAVersionsNr() method is present in a Java class
"ValidationUtilities.java", which I'm importing in my drl file and it looks
like this:
public class ValidationUtilities {
public static String evaVersionsNr;
public static String getZEVAVersionsNummer() {
return evaVersionsNr;
}
}
This static attribute "evaVersionsNr" is set to "1234" from another Java
class before I fire my rules. So, I assume that the eval construct should
return true. But, it does not return true and the consequence is not
exected.
Further info:
When I modify my rule like:
rule "rule 1"
when
eval(true)
then
System.out.println(getEVAVersionsNr());
end
the consequence part is getting executed and 1234 is getting printed.
I am really lost and I could not find out what goes wrong. If someone could
find out what I am missing, I shall be thankful.
Thanks in advance.
--
View this message in context: http://www.nabble.com/Problem-calling-a-function-returning-String-tp24375...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
How to Get out from the chain of rules
by Amila Silva
hi everyone;
I have faced the situation where i need to execute chain of rules and with
out any property change i need to get out from the executing the rest of the
rules.
Lets say i load all the data from the db and without loading to working
memory is there any way to skip through the other conditions. Or else do i
have to load the data into memory ?
--
Thanks,
Regrads,
Amila Silva,
Associate Software Engineer
hSenid Mobile Solutions
15 years, 5 months
Rule with temporal operators
by PriyaSha
Need your help to know what went wrong in the rule.
global java.lang.String output
declare OMNewTicket
@role( event )
@timestamp (timeStampAttr)
@expires (10m)
end
# Find 'critical' events of 'Windows' which occured after 1minute but before
10 minutes
# of 'warning' events of 'Symantec' provided no 'Security' with severity
'normal' exist in between
rule "Sample Temporal"
no-loop true
when
$ticket : OMNewTicket($severity1 : severity == "warning",
appName == "Symantec",
$timeStampAttr1 : timeStampAttr)
$ticket1 : OMNewTicket(this after[1m, 10m] $ticket,
severity == "critical",
$appName1 : appName == "Windows",
$timeStampAttr2 : timeStampAttr)
not (OMNewTicket( timeStampAttr <= $timeStampAttr2,
timeStampAttr >= $timeStampAttr1,
appName == "Login_failure", severity == "normal"))
then
drools.getWorkingMemory().setGlobal( "output", "found");
end
For the input :
e6382090-a259-71dd-12b9-92dfda160000 14178 10/25/2008:5:59:AM
warning Symantec Application
956cb3a0-a22d-71dd-09d7-c0195b7b0000 14178 10/25/2008:6:00:AM
warning Login_failure Security
28bdb2e0-a25a-71dd-1bc3-c01959f40000 14178 10/25/2008:6:05:AM
critical Windows Application
956cb3a0-a22d-71dd-09d7-c0195b7b0000 14178 10/25/2008:10:04:AM
normal Login_failure Security
20f39930-a27d-71dd-0369-81f8b3ee0000 14178 10/25/2008:10:04:AM
warning Symantec Application
648d5010-a27c-71dd-1bc3-c01959f40000 14178 10/25/2008:10:05:AM
critical Windows Application
8bcb9bb0-a32f-71dd-10c5-c01959dc0000 14179 10/26/2008:7:23:AM
warning Login_failure Security
8882ee70-a331-71dd-1fbc-c0068f170000 14179 10/26/2008:7:37:AM
warning Symantec Application
I get the below output:
405000 405000 0 warning
Symantec Sat Oct 25 05:59:00
406000 406000 0 warning
Login_failure Sat Oct 25 06:00:00
407000 407000 0 critical
Windows Sat Oct 25 06:05:00 found
408000 408000 0 normal
Login_failure Sat Oct 25 10:04:00
409000 409000 0 warning
Symantec Sat Oct 25 10:04:00
410000 410000 0 critical
Windows Sat Oct 25 10:05:00
411000 411000 0 warning
Login_failure Sun Oct 26 07:23:00 found
412000 412000 0 warning
Symantec Sun Oct 26 07:37:00
I use pseudo clock and I set the time in the third column(example
10/25/2008:5:59:AM) of the input as the 'timeStampAttr' by converting it to
long.
I also adjust the clock accordingly.
My requirement is to get the those 'critical-windows' event which happens
after 1 to 10minutes of 'warning-Symantec' provided no
'normal-Login_Failure' between them.
Problem here is, I could not get convinced with the occurance of found in
row #7. Coz 'Login_failure' did not occur between 10minute interval of a
symantec and windows event. Also my intention is to identify the windows
event.
--
View this message in context: http://www.nabble.com/Rule-with-temporal-operators-tp24370166p24370166.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
WorkItem and Parameter
by Geoff Cadien
I'm new to Drools (5.0.1) and attempted to create a simple workflow
example using a WorkItem and can't seem to figure out how to have
parameters passed to the WorkItem. I must be missing something
obvious (not understanding variable scopes maybe?) but just can't see
it. Below is the code I'm using:
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
type="RuleFlow" name="ruleflow" id="com.sample.ruleflow"
package-name="com.sample" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="16" y="16" >
</start>
<workItem id="2" name="Test" x="435" y="97" width="80" height="40" >
<work name="Test" >
</work>
<mapping type="in" from="p1" to="p1" />
</workItem>
<end id="3" name="End" x="240" y="16" />
</nodes>
<connections>
<connection from="1" to="2" />
<connection from="2" to="3" />
</connections>
</process>
public class Test {
public static void main( String[] args ) {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(
ResourceFactory.newClassPathResource("process.rf"), ResourceType.DRF
);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.getWorkItemManager().registerWorkItemHandler("Test",
new TestWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("p1", "param1");
ksession.startProcess("com.sample.ruleflow", params);
}
}
public class TestWorkItemHandler implements WorkItemHandler {
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
System.out.println(workItem.getParameters());
manager.completeWorkItem(workItem.getId(), null);
}
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
}
}
and the output:
Could not find variable scope for variable p1
when trying to execute Work Item Test
Continuing without setting parameter.
{}
Thanks in advance,
-geoff
15 years, 5 months
Design queries on use of Drools
by David Godfrey
Hi,
I am working on a prototype of integrating our existing application with
Drools, and would appreciate some advice/thoughts on my current design.
We have an application through which messages flow, and at certain points in
the process flow of these messages, business logic is encapsulated using
Java-based exits. I want to replace these exits with business rules, and
allow users to maintain the rules through Guvnor.
I have created a fact model, and also a simple Java class to invoke the
RuleAgent and execute my rules. At each processing step in my application, I
would like to expose a different set of rules, so I have defined a package
for each step, and assigned rules to the relevant package. At runtime, I am
hoping I can then just expose my model class to the relevant set of rules
for the processing step in question.
Does this sound like the best way to use Drools to solve the problem? Any
other considerations?
Also, can anyone point me in the direction of some useful information about
"functions" in the context of Guvnor? I would like to allow users to define
rules using the Guided Rules editor to make decisions about dates, but the
options available to me in the LHS of the editor don't seem to be rich
enough, I am assuming I can create a function to wrap some extra processing
logic which users can include in their rules? I can't find any good examples
of how to define/write such functions though.
Many thanks,
Dave
--
A. P. Herbert <http://www.brainyquote.com/quotes/authors/a/a_p_herbert.html>
- "A high-brow is someone who looks at a sausage and thinks of
Picasso."
15 years, 5 months
Does evaluating two facts of same type in one when condition works?
by balachandra maddina
Hi There,
Im wondering weather the Following rule would work properly,
rule "abc"
when
a : PlaceHolder(value == 1)
b : PlaceHolder(value == 2)
then
System.out.println("print");
.........................
workingmemory.insert(placeholderobject1);
workingmemory.insert(placeholderobject2);
workingmemory.fireAllRules();
..........................................
when i tried, the code is working fine, but How can the rule here is able to
diffirentiate between two facts of same type? any help would be very much
appriciated.
Thank you,
bala.
15 years, 5 months