This problem has perplexed us for a few weeks now. We have a server with multiple clients. I receive data from an outside source to feed the server, which then distributes the data to the clients via a listener-notifier pattern. I have a limited number of clients (4-6). Each client which registers to the server is on a separate thread to receive the data to eliminate any bottlenecks in processing. The server puts copies of the data to each client thread in a queue for sending out via RMI. The Thread then takes the data from the queue (a Vector) and sends to the clients.
Most of the time this works great. On occasion, We get a ClassCastException when sending the data to the clients. It seems this can be resolved by resending the data, but that is not satisfying as I don't want to be masking a more serious problem. This does not occur for all threads, the same data can be sent to the first 3 clients without problem, but the last one (and it always appears to be the last on in the list of Threads) gets the ClassCastException.
Any thoughts? The fact that is works most of the time is disturbing. Could this be a Threading issue? Examining the data does not reveal any issues with it. Obviously it is serialized or it would not work on the other Threads.
Another related issue dealing with the same code is that occassionally the Threads will get a Connection Refused RMI error. Again, not all the time, but only occasionally. And, not for all clients. Unfortunately, attempting to resend does not work for this case. After 3 tries, the data are dropped. This is the more insidious of the two issues. What causes this?
I'm using jdk1.5_01. This fails for both WinXP and Solaris 9 (and not Solaris connecting to XP via RMI, but two separate client-server configurations). The data are sent over a GigE link and the network loading is minimal.
Hi Joe Were you able to find any solution for the connection refused issue. I am also running into the same issue.Basically this is my scenerio. I have an application that has a RMI object(call it server app). It will launch other processes, and they in turn will talk to the RMI object.(call them client apps). The RMI server and the client appliacations are running for a long time.(overnight).The clients has timed out(meaning they were connected to Network Elements and timed out) and I close them. And again start them from the server app. The JVMs are launched, but when they try to talk to the RMI object in the server app, I get the connection refused.(Happens for my clients; but I cannot reproduce here at my development or test pcs) I read the sum.rmi.transport.tcp.readTimeout is set to 2 hours default. I tried tweaking this(I reduced it 5 minutes) to see whether I can reproduce,but no use. Any help would be really appreciated.
subject: Spurious ClassCastException and Connection refused in RMI