I am getting the following exception when I try to make an rmi call:
Traceback (innermost last):
File "client.py", line 9, in ?
AttributeError: sayHello
Since, it doesn't tell me anything about what failed on the Java side of
things, my best guess is that the object returned from Naming.lookup() is
not being cast correctly. Here is the source for the rmi client and server that I set up.
- client.py ---------------------------------------------------
from java.rmi import Remote, RemoteException, RMISecurityManager, Naming
from java.applet import Applet
from java.lang import System
System.setSecurityManager(RMISecurityManager())
obj = Naming.lookup("//localhost/HelloServer")
print "output: '%s'" % obj.sayHello()
---------------------------------------------------------------
- Hello.py ----------------------------------------------------
from java.rmi import Remote, RemoteException, RMISecurityManager, Naming
from java.rmi.server import UnicastRemoteObject
from java.lang import System
import traceback
class Hello(UnicastRemoteObject, Remote):
def sayHello():
return 'blah'
if System.getSecurityManager() is None:
System.setSecurityManager(RMISecurityManager())
obj = Hello()
Naming.rebind('//localhost/HelloServer', obj)
---------------------------------------------------------------
-Edwin
|