Posted By:
Xibin_Zeng
Posted On:
Wednesday, October 3, 2001 11:24 PM
I am exercising a simple RMI application and I am having problem connecting to my RMI server from a client that is on a different machine. It works fine if the client is on the same machine as the server. I am using Sun's ComputeEngine example which computes Pi to a desired precision. I also used their ClassFileServer which is a simple http file server(this allows you to specify your codebase in a http url). So here is the picture: Server side: javac server classes rmic remote class start class file server start rmiregistry start rmi server class If I compile and run the client on the serv
More>>
I am exercising a simple RMI application and I am having problem connecting to my RMI server from a client that is on a different machine. It works fine if the client is on the same machine as the server. I am using Sun's ComputeEngine example which computes Pi to a desired precision. I also used their ClassFileServer which is a simple http file server(this allows you to specify your codebase in a http url).
So here is the picture:
Server side:
-
javac server classes
-
rmic remote class
-
start class file server
-
start rmiregistry
-
start rmi server class
If I compile and run the client on the server, it works fine. Yes I made sure the client is not in the same package as the server to make sure the stubs are downloaded.
Now if I compile and run the client on my windows 2000 box, this is the exception that I am getting:
//CYPHER/.../classes $ java -Djava.rmi.server.codebase=http://10.1.1.1:2001/ -Djava.security.policy=poli
cy client.ComputePi 10.1.1.1 10
ComputePi exception: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:570)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:188)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:104)
at engine.ComputeEngine_Stub.executeTask(Unknown Source)
at client.ComputePi.main(ComputePi.java:22)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:296)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:162)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:149)
at java.net.Socket.connect(Socket.java:430)
at java.net.Socket.connect(Socket.java:379)
at java.net.Socket.
(Socket.java:293)
at java.net.Socket.
(Socket.java:121)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:125)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:565)
I am puzzeled. Any hint you can give me is appreciated.
Thanks!
<<Less