EOFException in ObjectInputStream Only happens with Webstart not by java(w).exe ?!

Posted by Houtman on Stack Overflow See other posts from Stack Overflow or by Houtman
Published on 2010-04-08T11:07:15Z Indexed on 2010/04/08 11:43 UTC
Read the original article Hit count: 269

Hi,

Anyone familiar with the differences in starting with Webstart(javaws.exe) compared to starting the app. using java.exe or javaw.exe regarding streams ?

This is the exception which i ONLY get when using Webstart :

java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
    at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
    at java.io.ObjectInputStream.<init>(Unknown Source)
    at fasttools.jtools.dss.api.core.remoting.thinclient.RemoteSocketChannel.<init>(RemoteSocketChannel.java:77)

This is how i setup the connections on both sides

//==Server side==
//Thread{ 
Socket mClientSocket = cServSock.accept();
new DssServant(mClientSocket).start();
//}

DssServant(Socket socket) throws DssException {
  try {
    OutputStream mOutputStream = new BufferedOutputStream( socket.getOutputStream() );
    cObjectOutputStream = new ObjectOutputStream(mOutputStream);
    cObjectOutputStream.flush(); //publish streamHeader
    InputStream mInputStream = new BufferedInputStream( socket.getInputStream() );
    cObjectInputStream = new ObjectInputStream(mInputStream);
    ..
  } catch (IOException e) {
    ..
  }
  ..
}

//==Client side==
public RemoteSocketChannel(String host, int port, IEventDispatcher eventSubscriptionHandler) throws DssException {
  cHost = host;
  port = (port == 0 ? DssServer.PORT : port);
  try {
    cSocket = new Socket(cHost, port);

    OutputStream mOutputStream = new BufferedOutputStream( cSocket.getOutputStream() );
    cObjectOut = new ObjectOutputStream(mOutputStream);
    cObjectOut.flush(); //publish streamHeader
    InputStream mInputStream = new BufferedInputStream( cSocket.getInputStream() );
    cObjectIn = new ObjectInputStream(mInputStream);

  } catch (IOException e) {
    ..
  }
  ..
}

Thanks

[EDIT] Webstart console says: Java Web Start 1.6.0_19 Using JRE version 1.6.0_19-b04 Java HotSpot(TM) Client VM

Server is running same 1.6u19

© Stack Overflow or respective owner

Related posts about java

Related posts about objectinputstream