Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SocketException: Connection reset by peer: socket write error RMI Server Class

e54b6fe1-20e3-4917-ac8f-b8b82798ca3cNov 5 2014 — edited Feb 11 2015

I am new to distributed application development. Got a project from university of making a chess game which can be played over the LAN. I started learning RMI to complete his project. I am using Eclipse and RMI plugin from genday. When I try to load the server class after starting registry. It doesn't throw any error exception in the server class console but server class stops before completion.

import java.rmi.RemoteException;

import java.rmi.registry.LocateRegistry;

import java.rmi.registry.Registry;

public class Server {

    public static void main(String args[]){

        try{

            PrintString stub = new PrintStringImpl();

            Registry registry = LocateRegistry.getRegistry();

            System.out.println(registry);

            registry.rebind("PrintString", stub);

            System.out.println("Started");

        }catch(RemoteException ex){

            ex.printStackTrace();

        }

    }

}

This Sever class print registry details before registry.rebind() and crashed at the same point without printing "Started". I displayed another console which is "C:\Program Files\Java\jdk\bin\rmiregistry.exe (localhost: 1099)". it is showing error like

Exception dispatching call to [0:0:0, 0] in thread "RMI TCP Connection(2)-192.168.3.106" at Wed Nov 05 09:52:03 PKT 2014:

java.rmi.UnmarshalException: error unmarshalling call header; nested exception is:

    java.net.SocketException: Connection reset by peer: socket write error

    at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)

    at sun.rmi.transport.Transport$1.run(Unknown Source)

    at sun.rmi.transport.Transport$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at sun.rmi.transport.Transport.serviceCall(Unknown Source)

    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)

    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)

    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    at java.lang.Thread.run(Unknown Source)

Caused by:java.net.SocketException: Connection reset by peer: socket write error

    at java.net.SocketOutputStream.socketWrite0(Native Method)

    at java.net.SocketOutputStream.socketWrite(Unknown Source)

    at java.net.SocketOutputStream.write(Unknown Source)

    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)

    at java.io.BufferedOutputStream.flush(Unknown Source)

    at java.io.ObjectOutputStream$BlockDataOutputStream.flush(Unknown Source)

    at java.io.ObjectOutputStream.flush(Unknown Source)

    at sun.rmi.transport.StreamRemoteCall.releaseOutputStream(Unknown Source)

    at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)

    ... 11 more

As far as, I am tackling with this problem by restarting laptop, and after restart it again works fine. There is no firewall installed and working on my computer. Any help would be greatly appreciated.

Comments

EJP

Please clarify. You state "It doesn't throw any error exception in the server class console but server class stops before completion", and you also post an exception. Which is it?

EJP

No clarification forthcoming. Locking as meaningless.

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 11 2015
Added on Nov 5 2014
2 comments
3,921 views