You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2002/03/07 07:29:04 UTC
Struts Upload - java.io.WriteAbortedException on DiskFile ??
I keep getting the exception below in my log files after I upload and write a
file to disk. I'm using code from the struts-upload example. Could it be that
my application is marked distributed in web.xml or my Form that holds this file
is marked Serializable?
Thanks,
Matt
========================== Exception ===============================
java.io.WriteAbortedException: Writing aborted by exception;
java.io.NotSerializableException: org.a
pache.struts.upload.DiskFile
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:445)
at
java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2263)
at
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1412)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1268)
at
org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:810)
at org.apache.catalina.session.FileStore.load(FileStore.java:317)
at
org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:295)
at org.apache.catalina.session.StoreBase.run(StoreBase.java:350)
at java.lang.Thread.run(Thread.java:484)
========================== Code ===============================
try {
//retrieve the file data
InputStream stream = file.getInputStream();
//write the file to the file specified
OutputStream bos = new FileOutputStream(filePath);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);
}
bos.close();
//close the stream
stream.close();
} catch (FileNotFoundException fnfe) {
System.err.println("FileNotFoundException: " + fnfe);
fnfe.printStackTrace();
} catch (IOException ioe) {
System.err.println("IOException: " + ioe);
ioe.printStackTrace();
}
//destroy the temporary file created
file.destroy();
__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>