I have create d simple DateServer program.When I am trying to run my server it is not able to create a socket and bind.Can anyone please help.It has taken lot of time and has been annoying. Following is the error out put C:\COURSE_WORK\EE633\TextCode\ch23\Server>java -Djava.security.policy=policy.all DateServer Exception in thread "main" java.rmi.ConnectException: Connection refused to host : 169.254.101.152; nested exception is: java.net.ConnectException: Connection refused: connect java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S ource) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S ource) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.newCall(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source) at java.rmi.Naming.rebind(Unknown Source) at DateServer.main(DateServer.java:30)
I think Yaroslav is probably right. Here's a little more explanation if you want it. Near the bottom of your exception trace, you'll notice the trouble starts with the call to Naming.rebind(). Your server code is attempting to publish the stub as a remote service. What you are binding to is a network service known as rmiregistry. It runs on port 1099 by default, unless of course it's not running at all. So you're being refused at 1099 because no one is listening to the (re)bind request. ------------------ Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
Joined: May 16, 2001
Hi Guys, Thanks!!.I resolved the problem.Thanks again for your help. Arvind
I have a problem with Rmi. I have a simple Client and a Server with a method that client says hello to the Server. The program works to some machines, and some others it doesen't work and i get the following excetion :
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested excepti on is: java.net.ConnectException: Connection refused: connect at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185 ) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101) at RmiServer_Stub.getRound(RmiServer_Stub.java:46) at RmiClient.main(RmiClient.java:53) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) at java.net.Socket.connect(Socket.java:452) at java.net.Socket.connect(Socket.java:402) at java.net.Socket.<init>(Socket.java:309) at java.net.Socket.<init>(Socket.java:124) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect SocketFactory.java:22) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster SocketFactory.java:128) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562) ... 5 more
For some reason i dont rely understant it tries to connect to localhost!!! but when the server is down (not running in the remote host) it says it cannot connect to the server IP....isnt that strange?!! Please give me any ideas!!