OK, resolved for 7.1a2 .

On Jul 10, 2007, at 12:46 PM, Henrique Lopes Cardoso wrote:

Hi,

I thought that this problem was solved before, but I am still getting
it. I am using the stable version Jess70p1.
If I remove a Userfunction and then add it again, it stops working and
throws an exception.

E.g.:
//---
        Rete jess = new Rete();
        FileReader fr = new FileReader("lixo.clp");
        Jesp j = new Jesp(fr, jess);
        j.parse(false);
        fr.close();

        jess.addUserfunction(new UF());

        jess.eval("(assert (a (s 1)))");
        jess.run();

        Userfunction uf = jess.findUserfunction("uf");
        jess.removeUserfunction("uf");
        jess.addUserfunction(uf);

        jess.eval("(assert (a (s 2)))");
        jess.run();
//---

; Contens of lixo.clp:
    (deftemplate a (slot s))
    (defrule r (a) => (uf))
;

From the second run() call, I am getting:
//
Exception in thread "main" Jess reported an error in routine uf
    while executing (uf)
    while executing defrule MAIN::r.
  Message: undefined function uf.
at jess.FunctionHolder$UndefinedFunction.call (FunctionHolder.java:54)
    at jess.FunctionHolder.call(FunctionHolder.java:35)
    at jess.Funcall.execute(Funcall.java:320)
    at jess.Defrule.fire(Defrule.java:322)
    at jess.Activation.fire(Activation.java:97)
    at jess.Agenda.run(Agenda.java:280)
    at jess.Agenda.run(Agenda.java:256)
    at jess.Rete.run(Rete.java:1505)
    at jess.Rete.run(Rete.java:1500)
    at UF.main(UF.java:44)


Henrique

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify owner-jess- [EMAIL PROTECTED]
--------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550                 http://www.jessrules.com

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to