[rules-users] Error due to same class name

Michael Anstis michael.anstis at gmail.com
Fri Jul 11 13:46:39 EDT 2014


The guided rule editors really, really, I mean really, do not handle
multiple classes with the same simple name in different packages at all
well.

Even if you only use a single class in a single rule (I.e. do not attempt
to use x.y.z.MyClass and a.b.c.MyClass) the overall DRL being compiled can
lead to issues as you're effectively creating:

"import x.y.z.MyClass

rule a
when
MyClass (...)
...
end"

and

"import a.b.c.MyClass

rule b
when
MyClass (...)
...
end"

I suspect issues to arise with class FQCN resolution in at least one of
those rules.

If you cannot use different simple names then my advice is to use free-form
DRL for these classes; using the FQCN in the rule and exclude the imports
(from the "Config" tab).

Sent on the move
On 11 Jul 2014 18:37, "Sumit Dhaniya" <sumitdhaniya at gmail.com> wrote:

> I've two classes with same name but in different packages.
> I created several guided rules which use these classes when I validate
> individual rules they get validated but when I try to Build and Deploy the
> project it fails cause it try to find a field in another class.
>
> Unable to create Field Extractor for 'isPH'Field/method 'isPH' not found
> for
> cla
> ss 'com.****.****.db.user.TmSlot'
>  : [Rule name='ProducerHour']
> org.drools.core.RuntimeDroolsException: Field/method 'isPH' not found for
> class
> 'com.****.****.db.user.TmSlot'
>
> Unable to Analyse Expression isPH == true:
> [Error: unable to resolve method using strict-mode:
> com.****.****.db.user.TmSlot.isPH()]
> [Near : {... isPH == true ....}]
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Error-due-to-same-class-name-tp4030304.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140711/39871977/attachment.html 


More information about the rules-users mailing list