RMI cllient reconnect gives java.rmi.NoSuchObjectException: no such object in table -



RMI cllient reconnect gives java.rmi.NoSuchObjectException: no such object in table -

ill seek explain setting.

setting: run 1 "server"(note: not rmi server) up. when run 1 client, client creates rmi host so:

string bindlocation = "//localhost/ntn"; seek { registry = locateregistry.createregistry(1099); naming.bind(bindlocation, ntn); } grab (malformedurlexception | alreadyboundexception e) {}

and server starts acting rmi client so:

seek { name = "//localhost/ntn"; ntni = null; ntni = (nodetonodeinterface) naming.lookup(name); ntni.serveranswer(k); k++; } catch(exception e) { system.err.println("fileserver exception: "+ e.getmessage()); e.printstacktrace(); }

this works. after client has received "server answer" unbinds so:

seek { naming.unbind(bindlocation); unicastremoteobject.unexportobject(registry,true); } grab (notboundexception e) {}

now if open seccond client(same code client 1) 1 time again start deed rmi server on same name , port. if set de same function runs on server , gives next error:

java.rmi.nosuchobjectexception: no such object in table

wich points line:

ntni = (nodetonodeinterface) naming.lookup(name);

how reinitialise it? or how prepare this? rmi server setup before server(rmiclient) uses serveranswer function.(and works teh first time)

don't unexport registry, , don't create when bind. create first , leave there life of jvm. otherwise there nil naming.lookup() talk to.

java rmi

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -