0

试图在 ubuntu 上通过公共 IP 设置 RMI 但徒劳无功。我已经设置了http隧道。RMI 服务器/applet 客户端在局域网上成功运行,ubuntu 作为 RMI 服务器。通过互联网,我能够在 1099 上成功运行服务器,将对象导出到固定端口 1100。我已将 1099 和 1100 端口转发到 ubuntu 192.168.1.XXX 的本地 IP。我还在 rmi 服务器和客户端上设置了以下内容

[rmiHostName = public ip]

//configuration
System.setProperty("java.security.policy","http://"+rmiHostName+"/basedir/rmi/java.policy");
System.setProperty("java.rmi.server.hostname",  rmiHostName);//external ip address
System.setProperty("java.rmi.server.codebase",http://"+rmiHostName+"/basedir/rmi/xxx-xxx-1.0.jar"); 

但是我收到以下异常:

network: Connecting public-ip/cgi-bin/java-rmi.cgi?forward=1099 with proxy=DIRECT
java.rmi.NotBoundException: //public-ip:1099/MyServer
    at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:136)
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
    at sun.rmi.transport.Transport$1.run(Transport.java:177)
    at sun.rmi.transport.Transport$1.run(Transport.java:174)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:772)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at rmi.source.StellarMessageClient.init(StellarMessageClient.java:99)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
basic: Applet initialized
basic: Starting applet
basic: completed perf rollup
basic: Applet made visible
basic: Applet started
basic: Told clients applet is started

你们能帮我解决这个问题吗?

4

1 回答 1

0
java.rmi.NotBoundException: //public-ip:1099/MyServer

您尚未将远程对象绑定到位于 //public-ip:1099 的注册表中,名称为 MyRegistry。

于 2012-08-16T10:16:40.197 回答