Hello, I am downloading a file from the server and saving it to the client disk. I am using a jsp file that cles a Java function. He makes it but gives the following error: "2001-12-13 08:44:27 - Ctx( /PS2 ): IllegalStateException in: R( /PS2 + /save.jsp + null) OutputStream is already being used for this request"
In the Java API, IllegalStateException is a Runtime Excepttion, so i think the problem is in Java. However i don't understand. I closed the outputstream and also flushed it.
Can you help me? I really don't know was is wrong!!!
Thanks Claudia
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Can you explain how you are trying to write to the client disk from a JSP? Are you trying to send something back through the "out" variable? Why not show a little code?
try { FileInputStream fileInput = new FileInputStream(pathFichEur); int numOfBytes = fileInput.available(); byte byteArray[] = new byte[numOfBytes]; int nextByte = fileInput.read(byteArray); fileInput.close();
OutputStream outStrm = res.getOutputStream(); outStrm.write(byteArray); //outStrm.flush(); outStrm.close(); } catch(IOException ioe) { System.out.println("download:file input exception");//.......... //ioe.printStackTrace(); } catch(Exception e) { System.out.println("download: exception");//.......... } } }" I hope you can help me!!! Thanks Claudia Vaz
Claudia Vaz
Ranch Hand
Joined: Nov 13, 2001
Posts: 44
posted
0
Hello again I forgot. I am using Tomcat. Also, in tha Java class i tried to cath the exception using the following code: "catch(IllegalStateException ise) { System.out.println("illegalstateexception: " + ise.getMessage()); ise.printStackTrace(); }" and in Tomcat window the system.out.println doesn't appear. Thanks Claudia Claudia
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
posted
0
System.out should write to the browser's console. ------------------ Bosun SCJP for the Java� 2 Platform
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.