jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes java.net.ConnectException with RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "java.net.ConnectException with RMI" Watch "java.net.ConnectException with RMI" New topic

java.net.ConnectException with RMI

Yupp Cook
Ranch Hand

Joined: Feb 07, 2006
Posts: 49
Hi all!

Need some help with this:
I ve got 3 MSDOS prompt windows. In the first rmiregistry is running. On starting the server it throws a ConnectException, see below. I correctly created the Stub and Skel classes. THE SAME APP RUNS ON ANOTHER COMPUTER WITHOUT PROBLEM, the client prints out "hello world" after starting the server the exact same way. What can be the problem? Can the ConnectException depend on DSL routing problems?

D:\sourcen\certification>java suncertify.server.ServerBS
java.rmi.ConnectException: Connection refused to host:; nested exception is:
java.net.ConnectException: Connection timed out: connect
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 suncertify.server.ServerBS.main(ServerBS.java:24)
Caused by: java.net.ConnectException: Connection timed out: 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.connect(Unknown Source)
at java.net.Socket.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 Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 7 more

Thanx for quick help.

SCJP 1.4<br />SCJD (BS2.1.2)
Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
You should be using Registry.createRegistry(1099) in the first place. You want the examiner to execute simply
java -jar runme.jar.
Don't get me started about those stupid light bulbs.
subject: java.net.ConnectException with RMI
It's not a secret anymore!