Just found out what the problem was.
I was defining my Userfunction as an innerclass of the main class where
I had the Rete instance. That main class was not Serializable, and that
was the class getting the NotSerializableException. Something like this:
class M {
Rete jess;
class F implements Userfunction, Serializable { ... }
public static void main(String args[]) {
...
jess.addUserfunction(new F());
...
jess.bsave(...);
}
}
==> Class M was getting the NotSerializableException
I then defined the Userfunction class F as an independent class,
implementing Serializable, and everything worked fine.
Thank you.
Henrique
friedman_hill ernest j wrote:
I think Henrique Lopes Cardoso wrote:
Just stating the class to be Serializable made it work, that is, bsave()
does not complain anymore and after bload()ing the functions work as
expected.
I then tried with a simpler example, which got me the
NotSerializableException again...
NotSerializableExceptions have the offending class name as the
exception message; what class is it complaining about? Note that Jess
can't do anything to make a serializable class non-serializable.
My question is: why does this approach work only sometimes?
There must be something else going on; I would double-check that all
the Userfunction class files were up to date with the source, and that
everything that's supposed to be serializable really is.
Is this approach recommendable[?]
Yes, definitely. Jess's "built-in" functions aren't actually special
in any way; they're just serializable Userfunctions.
---------------------------------------------------------
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://herzberg.ca.sandia.gov
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
--
----- - - - - - - - - - - - -
Henrique Lopes Cardoso
DEEC/FEUP
Rua Dr. Roberto Frias | 4200-465 Porto
PORTUGAL
(+351)225574199 ext.3355
[EMAIL PROTECTED] | www.fe.up.pt/~hlc
----- - - - - - - - - - - - -
--------------------------------------------------------------------
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]
--------------------------------------------------------------------