與啓動應用程序相比,熟悉Webstart(javaws.exe)開始差異的任何人。使用java.exe或javaw.exe關於流?ObjectInputStream中的EOFException僅在Webstart不是由java(w).exe發生?
這是使用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)
我就是這樣設置在兩側的連接
//==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) {
..
}
..
}
[編輯] Webstart的控制檯說: Java Web Start 1.6.0_19 使用JRE版本1.6.0_19-b04 Java HotSpot(TM)客戶端VM
服務器運行同樣1.6u19
[編輯] JNLP包含:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://127.0.0.1:8080/">
<information>
<title>..</title>
<vendor>..</vendor>
<homepage href="http://127.0.0.1:8080/index.html"/>
<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"/>
<jar href="http://127.0.0.1:8080/lib/yy.jar"/>
</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>
感謝
對不起,我也沒發佈JNLP文件.. 它已經包含了該設置。 – Houtman 2010-04-12 07:06:17
您可能還需要簽名。 – 2010-04-13 00:47:51