Hi Alex,
The problem here is that MyClass is not a public class. Jess can
only call methods of non-public classes if those methods override
or implement methods in public superclasses or interfaces. This is
not a Jess thing but a Java Reflection thing.
So, for example, when you call Vector.elements(), you get a
VectorEnumerator object, an instance of a nonpublic class. But Jess
can call all of the methods of VectorEnumerator that implement the
methods of Enumeration, and those that override methods in Object.
If you change the code below to call MyClass.toString or MyClass.hashCode,
etc., you'll see that it will work.
--------------------------------------
Hi,
I'm trying to send data from Jess to Java same way as it was suggested
in the mailing list (see JESS:Vector). Sample code works just fine.
But when I'm trying to run the following code:
MyClass p = new MyClass();
m_rete.store("P", p);
m_rete.executeCommand("(call (fetch P) putMsg \"test message\")");
I'm getting the following exception:
(call (fetch P) putMsg "test message")
Jess reported an error in routine call while executing (call (fetch P)
putMsg "test message").
Message: Method not accessible putMsg.
Program text: ( call ( fetch P ) putMsg "test message" ) at line 0.
MyClass is defined in the same file as :
class MyClass {
private Hashtable m_msgs;
public void putMsg (String msg) {m_msgs.put(msg, msg);}
}
The only difference is that I substituted Vector class with MyClass.
Are there any requirements on callable methods or anything else I
overlooked?
Thanks,
Alex
--
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------