I am curious if anybody has seen a similar behavior.
Currently I have a Sun SunBlade 2000 SPARC system running Solaris 10 with JDK 1.6.0_18.
Typically I run my RMI server here inside the NetBeans 6.8 IDE.
Most of the development and my network client I run it on Windows XP with JDK 1.6.0_17
using the latest Eclipse Java EE IDE.
Sometimes I leave my Sun on with my RMI server running overnight and the next morning
when I try to connect a network client I am unable to connect. However, the RMI server seems
to be running and still listening for incoming connections:
To solve the problem I just restart the RMI server and then everything works.
Has anybody seen similar behavior?
I still have not created my runme.jar and I wonder if this happens because I am running
inside the NetBeans IDE.
Did a Google Search and the only thing I was able to find was this FAQ.
and get a trace as indicated in B.7.
I will do some debugging about this in the next couple of days.
I have already added the debugging flag you suggested to all the server and client VMs.
The registry is started programatically by the server.
I have only observed this behavior after I leave the server running idle for hours.
To make a long story short, looks like when I leave my RMI Server idle, eventually its object gets Garbage Collected,
and the solution is a strong reference to it or to make the reference to it static.
Has anybody seen this before?
I doubt I am the first one.
The last paragraph here in the RMI spec makes it sound like this is something normal.
Because your title was "RMI Server Hang" (because you didn't know what was going on exactly), I totally didn't think about it. But after you posting the real exception, I totally remember it again I had the same issue and everything about it is described here. So you didn't try the search engine of this forum, otherwise you had found that thread yourself
I am glad I am trying to be as thorough as you are testing my SCJD assignment project that I am running
into some of the same problems you had in the past. Hopefully my results will be as close and
successful as you did!
I did use the Java Ranch SCJD forum search using "RMI Server Hang" and "RMI Server not responding"
but I didn't find anything related.
Also the nature of the problem since you still see the RMI registry still listening on port 1099 according
to netstat and my fault, the exception was hidden by the fact that my GUI Controller was catching it and
wrapping it throwing a GUI Controller exception without including the message of the original exception
before throwing the GUI Controller exception.
After some Eclipse debugging when I reproduced the problem and adding an
Exception printStackTrace() call before I throw my GUI Controller exception I was
finally able to narrow the problem.
I did the changes last night and used the -Djava.rmi.server.logCalls=true flag you had in your
posting (The one recommended by Karthik didn't produce any output) and just test it again and now I get:
Carlos Morillo wrote:I am glad I am trying to be as thorough as you are testing my SCJD assignment project that I am running
into some of the same problems you had in the past.
To be honest: I didn't test the RMI stuff thoroughly, experiencing this issue was just a coincidence. I started the RMI server, put the assignment on hold because football was on and afterwards trying to use the application again. But my Data class and business service implementation had a 100% test coverage for every possible situation (including normal execution, wrong arguments passed to methods, expected exceptions,...)
I had the same problem, but after having referenced the two remote objects in a static variable, it worked fine.
No remote exceptions anymore, even overnight and during watching all the great fc-bayern soccer matches .
You are not getting your message across about how you architected/designed this part
of your application.
If you have 2 separate different remote objects (that still I don't see the need and why)
I don't understand why you do have just a single static reference. It is not clear.
Likely other people like Roel and the assessor at Sun-Oracle will have a hard time understanding
your explanation ...
Anyway ... Good Luck,
Joined: Feb 07, 2010
In my solution I need two objects implementing the Remote interface (= the remote objects to me).
This has nothing to do with objects being registered to the RMI-registry , I also have only one object (the Business Model)
which is registered to the registry and declared as static variable.
The reason why I need two objects implementing the Remote interfaces is because I use MVC pattern in a push manner:
1. The local controller gets informed of any user gestures made by a client (for example book).
2. The controller informs the remote Business model (= service) and delegates the action to it
3. The model performs operations and informs any registered views (each one associated to a local client)
4. Since each view is associated with a client gui on the network, the view has to be defined remote as well.
So what's actually wrong having two remote objects? I think there's no alternative if you want to implement MVC in a push like manner.
And I only need one static reference to the model, because the model holds a list of registered views, and if the model cannot be garbage collected the views contained by the model cannot be either.
So please tell me, what's actually wrong with my approach?