permaculture playing cards*
The moose likes Distributed Java and the fly likes java.rmi.ConnectException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "java.rmi.ConnectException" Watch "java.rmi.ConnectException" New topic
Author

java.rmi.ConnectException

Chris
Greenhorn

Joined: Sep 01, 2004
Posts: 10
Hi,
when I compile my classes and generate the rmi-stubs, I get the following exception:

java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: 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 acme.core.Daemon.main(Daemon.java:76)
Caused by: 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.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


I get the exception on 3 different servers (WIN and UNIX).
Even when I try to start the program with older sourcefiles (that worked one year ago) it's the same.

I tried j2re1.4.2_05 and ..._09.
Who can help me??
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
You havent started rmiregistry or the naming server where you want to bind the stub.


keep smilin :: sravan<br /><a href="http://sravanpens.blogspot.com" target="_blank" rel="nofollow">I scribble here</a>
Chris
Greenhorn

Joined: Sep 01, 2004
Posts: 10
Hi, you we're right.
Because I get the exception after a few hours, I commented it out and forgot to take the comments away...
Thank you!
Chris
Greenhorn

Joined: Sep 01, 2004
Posts: 10
But do you have any idea, why the rmiregistry might crash after a few hours?
My program runs a few hours and gets the java.rmi.ConnectException.
And we have to restart the program.
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
Hi,

Because the rmiregistry starts and the programs run correctly intially, I do not think there is any problem with the Java setup or the program.

This seems more like a problem with your network or local sys. Does crashing occur at any particular time? Probably there is some job scheduled that interrupts rmiregistry.

I guess this has more to do with your local sys or network. Try troubleshooting. There seems to be no problem from the java side of it.
Chris
Greenhorn

Joined: Sep 01, 2004
Posts: 10
But it's strange that only with the newer mysql-database 4.1.13 this error occurs. With two older mysql-versions (4.0.17 and 3.x.x) the program (rmiregistry?) doesn't crash.
So we had to return to the older database.and everything works fine.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.rmi.ConnectException