rmi java.lang.ClassNotFoundException: testrmi2.fileserverimpl_Stub

荒凉一梦 提交于 2019-12-01 21:32:44

Try to set the classpath var before to execute the rmregistry:

export classpath="/Users/franco/Desktop/prova/"
rmiregistry 2005 &

There are three cases.

  1. You got that exception in the server when exporting/constructing the remote object. Solution: run rmic to generate the stub.
  2. You got it in the server when binding/rebinding. Solution: make the stub class available to the Registry's CLASSPATH, or run the Registry in the server JVM via LocateRegistry.createRegistry().
  3. You got it in the client, in lookup(). Solution: make the stub class available to the client's CLASSPATH.

These also apply to the remote interface itself, and any application classes it depends on, and so on recursively until closure.

Solution for stubs to all three: take the measures outlined in the Javadoc preamble to UnicastRemoteObject, so you don't need a stub at all.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!