I have seen this question has been brought up many times, but all the fixes I have seen either don't apply to my app or don't work. My app simply returns a byte array of a file. It needs to run in 1.4.2. My problems is that as soon as I try to call a remote function via RMI, my client crashes with a java.io.EOFException. Here is the exception:
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
+ java.io.EOFException+
+ at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)+
+ at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)+
+ at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)+
+ at java.rmi.Naming.lookup(Naming.java:84)+
+ at com.adtran.updater.Updater.downloadUpdateFile(Updater.java:48)+
+ at com.adtran.updater.Updater.main(Updater.java:158)+
Caused by: java.io.EOFException
+ at java.io.DataInputStream.readByte(DataInputStream.java:250)+
+ at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:195)+
+ ... 5 more+
Here is my server code:
public byte[] getUpdateFile(String os) {
try{
String fileName=null;
if (os.toLowerCase().startsWith("w"))
fileName=System.getProperty("oware.user.root"+File.separator+"adtranapps"+File.separator+"updater"+File.separator+"updateWin.zip");
else
fileName=System.getProperty("oware.user.root"+File.separator+"adtranapps"+File.separator+"updater"+File.separator+"updateSol.zip");
if (DEBUG) System.out.println("Update File: "+fileName);
File updateFile=new File(fileName);
if (updateFile.exists())
{
byte[] fileData=new byte[(int)updateFile.length()];
BufferedInputStream readFile = new BufferedInputStream(new FileInputStream(updateFile));
if (DEBUG) System.out.println("Reading file...");
readFile.read(fileData, 0, fileData.length);
readFile.close();
return (fileData);
}
else {
System.out.println("ERROR: Update file missing!");
}
}
catch (Exception e) {
System.out.println("EXCEPTION: Update failed!");
}
return null;
}
Edited by: Geekling on Jul 17, 2008 1:51 PM