[rules-users] Exception in thread "main" java.lang.Error: Unableto find unambiguously defined class

Anstis, Michael (M.) manstis1 at ford.com
Fri Jan 19 11:00:47 EST 2007


Thanks - worked a treat (I'd swear I'd tried that....)

-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at 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 at ford.com_>
>
>
>-----------------------------------------------------------------------
-
>
>_______________________________________________
>rules-users mailing list
>rules-users at 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 at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list