RE: [rules-users] Exception in thread "main" java.lang.Error: Unableto find unambiguously defined class
by Anstis, Michael (M.)
Sorry, newbie question - JIRA?!?!
I can guess it's a bug reporting facility, but I don't know where to
access it.
I've had a good nose around on Jboss.com but am none the wiser.
Thanks,
Mike
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: 20 January 2007 13:50
To: Rules Users List
Subject: Re: [rules-users] Exception in thread "main" java.lang.Error:
Unableto find unambiguously defined class
Actually this is also a bug, if you declare something as an import, it
should override the default java.lang.* imports - can you open a JIRA
for this bug.
Thanks
Mark
Edson Tirelli wrote:
> Michael,
>
> There is a java class named Process in java.lang package. As java
> imports all java.lang classes automatically, you will need to fully
> qualify your class name in this case.
>
> rule "A rule"
> when
> p:com.ford.nges.om.Process( )
> then
> System.out.println(p.toString());
> end
>
> I didn't test that, but shall work.
>
> []s
> Edson
>
> Anstis, Michael (M.) wrote:
>
>> Hi,
>>
>> I have a simple rule that references a "Process" fact:-
>>
>> package com.ford.nges.jboss.rules
>>
>> import com.ford.nges.om.Constants
>> import com.ford.nges.om.Component
>> import com.ford.nges.om.ResourceEntry
>> import com.ford.nges.om.Process
>> import com.ford.nges.om.Machine
>>
>> rule "A rule"
>> when
>> p:Process( )
>> then
>> System.out.println(p.toString());
>> end
>>
>> However I receive the following error on
>> builder.addPackageFromDrl(new
>> InputStreamReader(Main.class.getResourceAsStream("rules.drl"))); even
>> though I have an import statement.
>>
>> Exception in thread "main" java.lang.Error: Unable to find
>> unambiguously defined class 'Process', candidates are:
>> [java.lang.Process, com.ford.nges.om.Process]
>>
>> at
>> org.drools.semantics.java.ClassTypeResolver.resolveType(Unknown
>> Source)
>> at org.drools.semantics.java.RuleBuilder.build(Unknown
>> Source)
>> at org.drools.semantics.java.RuleBuilder.build(Unknown
>> Source)
>> at org.drools.semantics.java.RuleBuilder.build(Unknown
>> Source)
>> at org.drools.compiler.PackageBuilder.addRule(Unknown
>> Source)
>> at
org.drools.compiler.PackageBuilder.addPackage(Unknown
>> Source)
>> at
>> org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
>> Source)
>> at com.ford.nges.Main.main(Main.java:43)
>>
>> If "Process" is referred to in the RHS or the Class name is not
>> Process I don't get the error.
>>
>> Any thoughts?
>>
>> With kind regards,
>>
>> Michael Anstis
>> -------------------------------------------
>> *Next Generation Estimating System*
>> ( Trafford House (Int) 8 718 2239
>> ( Trafford House (Ext) +44 (0)1268 702239
>> * <_mailto:manstis1@ford.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, 11 months
Exception in thread "main" java.lang.Error: Unable to find unambiguously defined class
by Anstis, Michael (M.)
Hi,
I have a simple rule that references a "Process" fact:-
package com.ford.nges.jboss.rules
import com.ford.nges.om.Constants
import com.ford.nges.om.Component
import com.ford.nges.om.ResourceEntry
import com.ford.nges.om.Process
import com.ford.nges.om.Machine
rule "A rule"
when
p:Process( )
then
System.out.println(p.toString());
end
However I receive the following error on builder.addPackageFromDrl(new
InputStreamReader(Main.class.getResourceAsStream("rules.drl"))); even
though I have an import statement.
Exception in thread "main" java.lang.Error: Unable to find
unambiguously defined class 'Process', candidates are:
[java.lang.Process, com.ford.nges.om.Process]
at
org.drools.semantics.java.ClassTypeResolver.resolveType(Unknown Source)
at org.drools.semantics.java.RuleBuilder.build(Unknown
Source)
at org.drools.semantics.java.RuleBuilder.build(Unknown
Source)
at org.drools.semantics.java.RuleBuilder.build(Unknown
Source)
at org.drools.compiler.PackageBuilder.addRule(Unknown
Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown
Source)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown Source)
at com.ford.nges.Main.main(Main.java:43)
If "Process" is referred to in the RHS or the Class name is not Process
I don't get the error.
Any thoughts?
With kind regards,
Michael Anstis
-------------------------------------------
Next Generation Estimating System
* Trafford House (Int) 8 718 2239
* Trafford House (Ext) +44 (0)1268 702239
* <mailto:manstis1@ford.com>
17 years, 11 months
help! asserting facts before reading rules?
by Justine Hlista
I have a dummy program that asserts 2 simple facts into working memory, then
reads a simple rule file into the rule base, then fires the rules. I've
attached the rules and the NullPointerException that results.
However, if I read the rules first then assert the facts, the program runs
fine.
Alternatively, if I modify the second rule such that the modify occurs
before the retract, the program runs fine even if I assert the facts first
then read the rules.
In general, I may not be able to control when facts are asserted vs. when
rules are read in. Should this be a problem?
Any hints greatly appreciated!!
Thanks,
Justine
simple.drl:
rule "setupFactC"
no-loop true
when
a: factA(s:field1, i:field2, f:field3)
not c : factC(f1==s)
then
assert(s != null ? new factC(s, i, f) :
new factC());
end
rule "factBWithRetract"
no-loop true
when
b : factB(s:f1, i:f2, f:f3)
a : factA(field1==s)
c : factC(f1==s)
then
c.setF3(f);
retract(b);
modify(c);
end
Stack trace:
java.lang.NullPointerException
at org.drools.base.com.vsasset.rules.isolate.factB$getF1.getValue(Unknown
Source)
at org.drools.base.ClassFieldExtractor.getValue(Unknown Source)
at org.drools.rule.Declaration.getValue(Unknown Source)
at org.drools.rule.BoundVariableConstraint.isAllowed(Unknown Source)
at org.drools.common.BetaNodeBinder.isAllowed(Unknown Source)
at org.drools.reteoo.JoinNode.modifyObject(Unknown Source)
at org.drools.reteoo.ObjectSource.propagateModifyObject(Unknown Source)
at org.drools.reteoo.ObjectTypeNode.modifyObject(Unknown Source)
at org.drools.reteoo.Rete.modifyObject(Unknown Source)
at org.drools.reteoo.ReteooRuleBase.modifyObject(Unknown Source)
at org.drools.reteoo.ReteooWorkingMemory.modifyObject(Unknown Source)
at org.drools.base.DefaultKnowledgeHelper.modifyObject(Unknown Source)
at com.vsasset.rules.isolate.Rule_factBWithRetract_0.consequence
(Rule_factBWithRetract_0.java:10)
at
com.vsasset.rules.isolate.Rule_factBWithRetract_0ConsequenceInvoker.evaluate
(Rule_factBWithRetract_0ConsequenceInvoker.java:26)
at org.drools.common.DefaultAgenda.fireActivation(Unknown Source)
at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
at com.vsasset.rules.isolate.TestCase.main(TestCase.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Exception in thread "main" org.drools.spi.ConsequenceException:
java.lang.NullPointerException
at org.drools.common.DefaultAgenda.fireActivation(Unknown Source)
at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
at com.vsasset.rules.isolate.TestCase.main(TestCase.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
17 years, 11 months
RE: [rules-users] Exception in thread "main" java.lang.Error: Unableto find unambiguously defined class
by Anstis, Michael (M.)
Thanks - worked a treat (I'd swear I'd tried that....)
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: 19 January 2007 16:36
To: Rules Users List
Subject: Re: [rules-users] Exception in thread "main" java.lang.Error:
Unableto find unambiguously defined class
Michael,
There is a java class named Process in java.lang package. As java
imports all java.lang classes automatically, you will need to fully
qualify your class name in this case.
rule "A rule"
when
p:com.ford.nges.om.Process( )
then
System.out.println(p.toString());
end
I didn't test that, but shall work.
[]s
Edson
Anstis, Michael (M.) wrote:
> Hi,
>
> I have a simple rule that references a "Process" fact:-
>
> package com.ford.nges.jboss.rules
>
> import com.ford.nges.om.Constants
> import com.ford.nges.om.Component
> import com.ford.nges.om.ResourceEntry
> import com.ford.nges.om.Process
> import com.ford.nges.om.Machine
>
> rule "A rule"
> when
> p:Process( )
> then
> System.out.println(p.toString());
> end
>
> However I receive the following error on builder.addPackageFromDrl(new
> InputStreamReader(Main.class.getResourceAsStream("rules.drl"))); even
> though I have an import statement.
>
> Exception in thread "main" java.lang.Error: Unable to find
> unambiguously defined class 'Process', candidates are:
> [java.lang.Process, com.ford.nges.om.Process]
>
> at
> org.drools.semantics.java.ClassTypeResolver.resolveType(Unknown
> Source)
> at org.drools.semantics.java.RuleBuilder.build(Unknown
> Source)
> at org.drools.semantics.java.RuleBuilder.build(Unknown
> Source)
> at org.drools.semantics.java.RuleBuilder.build(Unknown
> Source)
> at org.drools.compiler.PackageBuilder.addRule(Unknown
> Source)
> at org.drools.compiler.PackageBuilder.addPackage(Unknown
> Source)
> at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
> Source)
> at com.ford.nges.Main.main(Main.java:43)
>
> If "Process" is referred to in the RHS or the Class name is not
> Process I don't get the error.
>
> Any thoughts?
>
> With kind regards,
>
> Michael Anstis
> -------------------------------------------
> *Next Generation Estimating System*
> ( Trafford House (Int) 8 718 2239
> ( Trafford House (Ext) +44 (0)1268 702239
> * <_mailto:manstis1@ford.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 3124-6000
Mobile: +55 11 9218-4151
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
17 years, 11 months
Rule authoring: Eclipse plug-in in WebSphere Application Developer 5.1.1 \ Rational Application Developer 6
by Anstis, Michael (M.)
Hi,
Has anybody had any joy configuring the Eclipse Rules IDE plug-in for
the above?
These commercial applications are based on Eclipse, but I can't get the
3.0.5 plug-in to be recognised :-(
Corporately we prefer to pay for the commercial equivalents...
With kind regards,
Michael Anstis
-------------------------------------------
Next Generation Estimating System
* Trafford House (Int) 8 718 2239
* Trafford House (Ext) +44 (0)1268 702239
* <mailto:manstis1@ford.com>
17 years, 11 months
How do i Load & Execute specific rules in my drl file
by Raja.Bobbala@sanofi-aventis.com
How do i load & execute specific rules in my drl file? For ex.,
I have 5 rules defined in rules.drl
rule "1"
when
cond #1
then
System.out.println("Applying Rule 1");
end
rule "2"
when
cond #2
then
System.out.println("Applying Rule 2");
end
rule "3"
when
cond #3
then
System.out.println("Applying Rule 3");
end
rule "4"
when
cond #4
then
System.out.println("Applying Rule 4");
end
rule "5"
when
cond #5
then
System.out.println("Applying Rule 5");
end
>From my Java class, based on some conditions, i should call the respective rules.
public void CheckRules(){
if (some Condition){
// Execute rule1, rule2
}else if (some Condition){
// Execute rule1, rule3
}else if (some Condition){
// Execute rule3, rule5
}else if (some Condition){
// Execute rule1,rule2,rule3,rule5
}
}
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(FieldValidation.class.getResourceAsStream("/BizRules.drl")));
RuleBase rulebase = RuleBaseFactory.newRuleBase();
rulebase.addPackage(builder.getPackage());
WorkingMemory workingMemory = rulebase.newWorkingMemory();
workingMemory.assertObject(object1);
workingMemory.assertObject(object2);
workingMemory.fireAllRules(new RuleNameEqualsAgendaFilter("1"));
workingMemory.clearAgenda();
WorkingMemory workingMemory1 = rulebase.newWorkingMemory();
workingMemory1.assertObject(object1);
workingMemory1.assertObject(object2);
workingMemory1.fireAllRules(new RuleNameEqualsAgendaFilter("2"));
Is there any way by which we can add specific rules to the Agendafilter and call fireAllRules() with the rulelist as parameter.
17 years, 11 months
Asserting objects of same class
by Nirmal.R
Hi,
I assert objects of same class into the working memory
e.g
asssert(new String("first assert"));
asssert(new String("second assert"));
asssert(new String("Third assert"));
does the engine follows any order while resolution or is there any way to
impose such order i.e if instance of same class are asserted, resolve the
objects in the same order in which it was asserted
thanx
Nirmal
--
View this message in context: http://www.nabble.com/Asserting-objects-of-same-class-tf3033511.html#a842...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 11 months
justification
by Joost de Vries
Hi people,
My requirements call for some justification report functionality to go with
outcomes from my expert system. To give a concrete example; I have a
calculation of the early release date of a prisoner and I need a generated
reasoning how this result was reached.
(see this weblog entry from Diettrich Kappe for a description that is very
similar to what we aim to do
http://blogs.pathf.com/business_rules/2006/07/the_short_circu.html )
Have any of you implemented justification functionality? What are available
hooks in drools?
Best regards,
Joost de Vries
--
Joost de Vries
17 years, 11 months
SLA as rules?
by Elena Ţibrea
Hello again,
Do you think it is possible to specify SLAs(service level agreements) as
rules? Do you see any difficulties in translating SLA to rule
languages(e.gSLAs have time frames and use metrics for specifying the
condition part)?
Thanks.
17 years, 11 months
Specifing rules with the help of OCL
by Elena Ţibrea
Hi,
I've been recently reading an article about OCL where the authour states he
sees no major dificulties for adopting OCL as notation for specifying
the *activation
condition* that triggers the *action part* of a reactive rule.
I wonder than why rule engines use proprietary rule languages and not smth
standardized like OCL?
17 years, 11 months