Using a package would be recommended, and if that doesn't work, then the
rule engine must not be on the same classpath as your own model objects when
its executed.

On 4/10/06, Paschetta Elio <[EMAIL PROTECTED]> wrote:
>
> Thanks.
> The rule file has:
> ===========================
> <?xml version="1.0"?>
>
> <rule-set name="BasicTest"
>           xmlns="http://drools.org/rules";
>           xmlns:java="http://drools.org/semantics/java";
>           xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
>           xs:schemaLocation="http://drools.org/rules rules.xsd
>                              http://drools.org/semantics/java java.xsd">
>
>     <import>java.lang.Object</import>
>     <import>StringFact</import>
>
>         <rule name="first">
>                 <parameter identifier="str">
>                         <class>StringFact</class>
>                 </parameter>
>                 <java:condition>str.equals("Hello")</java:condition>
>                 <java:consequence>
>                         str.setValue("Goodbye");
>                         drools.modifyObject(str);
>                         System.out.println("Rule 'first' executed");
>                 </java:consequence>
>         </rule>
>
>         <rule name="second">
>                 <parameter identifier="str">
>                         <class>StringFact</class>
>                 </parameter>
>                 <java:condition>str.equals("Goodbye")</java:condition>
>                 <java:consequence>
>                         drools.retractObject(str);
>                         System.out.println("Rule 'second' executed");
>                 </java:consequence>
>         </rule>
>
> </rule-set>
> ===========================
>
> The StringFact.java file which defines my custom fact is:
>
> ==============================
>
>
> public class StringFact {
>
>         private String value = "";
>
>         public StringFact(String str) { setValue(str); }
>
>         public String getValue() { return value; }
>
>         public void setValue(String value) { this.value = value; }
>
>         public boolean equals(String str) { return value.equals(str); }
> }
> ================================
>
> As you see there is no package. I tried also with a package but nothing
> changes.
> Thank you.
> Elio
>
> -----Original Message-----
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: lunedì 10 aprile 2006 9.18
> To: [email protected]
> Subject: Re: [drools-user] Cannot use custom facts in drools 2.5
>
> can you paste important bits from your rule file?
>
> On 4/7/06, Paschetta Elio <[EMAIL PROTECTED]> wrote:
> >
> > Hello all,
> >         I am new to drools.
> > I have downloaded drools 2.5 and I can't make my example working. In
> > particular I can't manage to define a custom object to use as a fact
> > and I obtain during execution:
> >
> > A problem occured compiling the embedded code:
> > drools/org/basictest_1144417731239/java/First_0.java(3)
> > The import StringFact cannot be resolved
> > drools/org/basictest_1144417731239/java/First_0.java(15)
> > StringFact cannot be resolved to a type
> >
> > First is the name of the rule and StringFact is my class.
> >
> > Getting the example compile was very difficult because a lot of jars
> > were missing from the distribution and I am not sure about I've
> > inserted the correct versions got from Internet.
> >
> > I have not inserted my file into a package, but even if I do there are
> > the same messages. I have compiled using Eclipse (I am new to it too),
> > but if I compile with the command line (javac and then java) nothing
> > changes.
> >
> > Is it possible everything is so difficult to get things working?
> > Why there is not a step by step explanation of things?
> >
> > I am very frustrated and after a few days battle I am on the point of
> > giving up and try some other tools.
> >
> > Please help me!
> >
> >
> > Thank you
> > Best regards.
> >
> > Elio Paschetta
> > --------------------------------------------------------------------
> >
> > CONFIDENTIALITY NOTICE
> >
> > This message and its attachments are addressed solely to the persons
> > above and may contain confidential information. If you have received
> > the message in error, be informed that any use of the content hereof is
> prohibited.
> > Please return it immediately to the sender and delete the message.
> > Should you have any questions, please contact us by replying to
> > [EMAIL PROTECTED]
> >
> >         Thank you
> >
> >                                         www.telecomitalia.it
> >
> > --------------------------------------------------------------------
> >
> --------------------------------------------------------------------
>
> CONFIDENTIALITY NOTICE
>
> This message and its attachments are addressed solely to the persons above
> and may contain confidential information. If you have received the message
> in error, be informed that any use of the content hereof is prohibited.
> Please return it immediately to the sender and delete the message. Should
> you have any questions, please contact us by replying to
> [EMAIL PROTECTED]
>
>         Thank you
>
>                                         www.telecomitalia.it
>
> --------------------------------------------------------------------
>

Reply via email to