views:

235

answers:

2

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) {
    ..
  }
  ..
}

[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

[EDIT] JNLP contains:

<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="1.0+" codebase="http://127.0.0.1:8080/"&gt;
  <information>
    <title>..</title>
    <vendor>..</vendor>
    <homepage href="http://127.0.0.1:8080/index.html"/&gt;
    <description>..</description>
    <icon href="/jws/.."/>
    <icon kind="splash" href="/jws/...jpg"/>
    <offline-allowed/>
  </information>

  <security>
    <all-permissions/>
  </security>

  <resources>
   <j2se version="1.6+" initial-heap-size="128M" max-heap-size="512M"/>
   <jar href="http://127.0.0.1:8080/lib/xx.jar"/&gt;
   <jar href="http://127.0.0.1:8080/lib/yy.jar"/&gt;
  </resources>

  <application-desc main-class="..">
    <argument>-host</argument>     <argument>127.0.0.1</argument>
    <argument>-port</argument>     <argument>4359</argument>
    <argument>-httpport</argument> <argument>8080</argument>
  </application-desc>
</jnlp>

Thanks

A: 

I think that you may have to request for permission in your JNLP file. Try adding

<security>
   <all-permissions/>
</security>

See http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html.

Chuk Lee
Sorry i didn't also post the Jnlp file.. it already contained that setting.
Houtman
You probably have to sign it as well.
Chuk Lee
A: 

oH mY!!

I found out what the problem was.. The JNLP file which was generated by a servlet which was copied from an existing program, supplied port-nr arameters. But the port-numbers weren't corrected.. The supplied port was an (Existing) Secure Socket.. my app used a Non-Secure Socket !!

What an awfull mistake

Houtman