I'm writing an app using RMI, and for now am testing with the server on the same machine as the client. (server = localhost)
Things are working, except that one process seems to get sporadic Connection Refused problems.
This thread runs every few minutes. The first operation using the RMI Remote object works fine. The 2nd works fine - for a while.
Then it starts failing on the 2nd call each time the thread executes. The first call continues working.
Why would it get a Connection Refused on the 2nd call to the RMI object - sometimes?
A cap on the number of connections from the same client perhaps? Who knows. Connection refused is something that stems from the host you are connecting to, you'll have to somehow figure out why the host is rejecting your connections sporadically. I hope for you that does not include having to deal with an external party.