Connection Refused Exceptions
Rick Moynihan <[email protected]>
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
Hey all,
I've recently been trying to fix a problem with some Jini (v1.2.1_001)
Services/Clients (all services are peers, i.e. services and clients)
receiving a Connection Refused Exception.
The problem seems to occur if I restart my services (or a subset of
them) prior to their leases expiring. Sometimes after the restart I
will get the following sort of Exception:
Caused by: java.rmi.ConnectException: Connection refused to host:
192.168.0.205; nested exception is:
java.net.ConnectException: Connection refused
at
sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
SNIP ...
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:179)
at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at
sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
I've done some digging, and it seems that this is often attributed to an
incorrectly set codebase. However as far as I can tell there are no
problems here, as I can run my services across multiple machines, and I
can browse them with the LookupBrowser.
To clarify:
* I have a script that start's reggie by first loading a HTTP Server
(ClassServer) followed by rmid (with the hostname set properly), and
then reggie.
* My services have their own codebase server, with the codebase set
properly via java.rmi.server.codebase. I can test this with the example
LookupBrowser and the services display properly with no class not found
errors etc...
I am using the ServiceDiscoveryManager and the LookupCache, and I call
discard() when I get an exception. However, after the discardWait when
the services are rediscovered the communication also fails with the same
error, leading to a cycle of repeated discards, rediscovery, and
ConnectExceptions.
I never seem to get this error if I clear and restart the lookup service
before restarting the services. However I shouldn't need to do this.
I'm using RMI to communicate between the proxy and the service, and I
suspect the problem is that the proxy's RMI stub to the
UnicastRemoteObject is stale because of the restart. However, upon
restart my services all register back with the lookup service through
the JoinManager. Though my knowledge of RMI is sketchy, I would have
thought that this process would ensure that a new proxy/stub was
registered on the lookup service.
Does anyone have any ideas on what might be causing the problem? Any
help would be highly appreciated.
Thanks again,
--
Rick Moynihan
Software Engineer
Calico Jack LTD
http://www.calicojack.co.uk/
--------------------------------------------------------------------------
Getting Started: http://www.jini.org/wiki/Category:Getting_Started
Community Web Site: http://jini.org
jini-users Archive: http://archives.java.sun.com/archives/jini-users.html
Unsubscribing: email "signoff JINI-USERS" to [email protected]