[rules-users] External Jar/Pojo in Drools Workbench.

Michael Anstis michael.anstis at gmail.com
Thu Apr 10 08:14:22 EDT 2014


There should be no need to extend the classes in the JAR using the Data
Modeller (unless you really want to of course).

Did you import all the classes your rule needs - if they are in different
packages - with the "Config" tab?

Can you please provide your JAR and a screen-shot of the rule you're trying
to author?




On 10 April 2014 12:58, Leonard93 <leonardlindenau at hotmail.com> wrote:

> Hello everyone, I have a small question/problem.
>
> I have created a class (POJO) in Eclipse and I want to be able to write
> rules over this class in the Drools Workbench, thus I exported the class
> and
> the classes it depends on (1 other class) to a Jar and imported it in the
> Drools workbench.
>
> Now what I did next is I added the jar dependency to my workbench project,
> created a new datamodel and set its super class to the external class from
> the jar and left the rest empty.
>
> When I then try to use this datamodel in a guided rule or anything I can
> access the variables defined in the external class fine when using the rule
> editor. But when I save I get various compiler errors.
>
> Currently I tried to make a rule template and I got these errors (I am
> using
> the standard example project to test it out):
>
> Unable to create Field Extractor for *'Destination'Field/method
> 'destination'* not found for class '*org.mortgages.Test' *
>
> Unable to Analyse Expression *Destination ==
> GenericDataObject$Country.Germany*: [Error: unable to resolve method using
> strict-mode: *org.mortgages.Test.GenericDataObject$Country()]* [Near :
> {...*
> Destination == GenericDataObject$Country.Germ ....}]* ^ [Line: 9, Column:
> 2]
>
>
> The class from the jar looks like this:
> public class GenericDataObject {
>
>     public enum Country
>     {
>         Egypt,
>         Germany,
>         Turkey,
>         France,
>         Unknown
>     }
>
>     public GenericDataObject()
>     {
>         result = new Result();
>     }
>
>     public Result result;
>     public Country Destination;
>
>     public void setDiscount(int amount)
>     {
>         result.discount = amount;
>     }
> }
>
> public class Result
> {
>     public int discount;
>
>     public Result()
>     {
>         discount = 0;
>     }
> }
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/External-Jar-Pojo-in-Drools-Workbench-tp4029190.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/20140410/e4103828/attachment-0001.html 


More information about the rules-users mailing list