Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RMI callbacks problem

Posted on 2002-06-09
7
Medium Priority
?
474 Views
Last Modified: 2012-08-13
Hi,
I'm running an RMI application with callbacks.
Usually it works fine, but occasionally, when the server tries to invoke a method on the client the following exception is thrown in the server side:

java.rmi.ConnectException: Connection refused to host: <client ip address>; 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(PlainSocketImpl.java:320)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
        at java.net.Socket.<init>(Socket.java:273)
        at java.net.Socket.<init>(Socket.java:100)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:120)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:83)
        at com.sanrad.nms.client.comm.CommunicationEventService_Stub.elementCreate(CommunicationEventService_Stub.java:37)
        at com.sanrad.nms.server.logic.EventServiceImpl.fireElementCreate(EventServiceImpl.java:49)
        at com.sanrad.nms.server.logic.ClusterImpl.newElement(ClusterImpl.java:97)
        at com.sanrad.nms.server.mgr.EventMgr.sendAddElementEvent(EventMgr.java:70)
        at com.sanrad.nms.server.mgr.CreateElementThread.run(CreateElementThread.java:36)

What could be the cause?
0
Comment
Question by:s_lavie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 7065138
 I remember a few months ago I had the same problem as well but I was working on a Linux machine (I am not sure what operating system you are using) and I was trying to connect to the localhost.

  I was invoking the getLocalHost() method to construct the rmi url and this was returning the loop-back interface address. What I did was to change the order of the IP address in the /etc/hosts file and move the localhost IP at the end (and had the eth0 name/IP address at the top).

  I am not sure if it helps but it might give you some clues.
0
 
LVL 2

Author Comment

by:s_lavie
ID: 7065144
well, I'm working on win2000.
I'm not sure your description fits mine, but thanks anyway ;-)
0
 
LVL 35

Expert Comment

by:girionis
ID: 7065530
 Sorry I did not help. It is really weird though because form what you say it seems that it connects and works properly and all of a sudden it throws an exception.

  Things you have to consider. Is the method called succesfully at some earlier point and fails at some later? Is the method called for the first time and raises an exception? If the latter is the issue then there is obviously something wrong with the method call itself. If not then there must be something wrong under the TCP/IP covers.

  The machine you are trying to connect might accept a limited number of connections only and when this number is reached then it raises an exception indicating that it accepts no more connections.

  There is usually a generic TCP/IP listener that you are trying to connect and each vendor implements it differently. This means that this listener has a count of connections and when this count is reached then it will "hand up" and will refuse further connections. One possible solution is that you might be exceeding the connections limit because you have loads of connections or too many things are trying to connect to quickly.

  I guess this limit is configurable so you could actually increase the number of connections (although I am not sure how you could do it). But, if this is the problem, I would suggest to find out first why this limit is reached.

  Hope it helps. Apart from thsi I cannot think of anything else why your connection is refused.

  Hope it helps.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 16

Expert Comment

by:heyhey_
ID: 7066289
Connection refused means that remote TCP stack does not accept your TCP (SYN ?) packet. that usually means that some of the TCP buffers on the remote machine are full.

in your case, it seems that ServerSocket backlog must be increased.

************

public ServerSocket(int port, int backlog) throws IOException
Creates a server socket and binds it to the specified local port number, with the specified backlog. A port number of 0 creates a socket on any free port.

The maximum queue length for incoming connection indications (a request to connect) is set to the backlog parameter. If a connection indication arrives when the queue is full, the connection is refused.
0
 
LVL 2

Author Comment

by:s_lavie
ID: 7066299
I found the problem. It was a silly bug, and to tell you the true I feel quite a shame...
I'll tell you anyway.
The bug was: making a call to a client that was disconnected from the server. Obviously the call failed, and instead of continue calling the other clients I just exited the method.
Sorry for the bothering, but thanks anyway ;-)
0
 
LVL 35

Expert Comment

by:girionis
ID: 8834293
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- To be PAQ'ed and points refunded

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 8910297
Question is PAQ'd and points refunded.

YensidMod
EE Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question