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
>
>