• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

IOException when i close a stream in Applet WHY!!!!

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an applet which connects to a servlet which in turn connect to sql.I get the following error however IOEXception at java/io/ObjectOutputStream.close
Thank u all for your time
URL dataURL = new URL("http://servename/Servlet/Serve");
URLConnection connection = dataURL.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches (false);
connection.setDefaultUseCaches (false);
connection.setRequestProperty ("Content-Type", "application/octet-stream");

ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream());
out.writeObject(getTextField1().getText());
out.flush();
out.close();
out.close();out.close();
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you really closing this stream 3 times? If the stream is already closed, closing it again will produce an exception.
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no sorry im only closing it once I was trying to make it bold and it copied it several times
sorry
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can edit your original post if you like by clicking on the little edit icon at the top of the message (the paper and pencil icon).
As for the exception, can you include the actual output from System.err? Where is the exception getting thrown, and what does the stack trace look like?
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.io.IOException: ServerName//Servlet/Serve
at com/ms/net/net/wininet/http/HttpInputStream.connect
at com/ms/net/net/wininet/http/HttpInputStream.<init>
at com/ms/net/net/wininet/http/HttpURLConnection.createInputStream
at com/ms/net/wininet/WininetURLConnection.getInputStream
at com/net/wininet/http/HttpPostBufferStream.close
at java/io/ObjectOutputStream.close
at t/TestOne.addName
at java/lang/reflect/Method.invoke
at t/ReflectiveAction.actionPerformed
at java/awt/Button.processActionEvent
at java/awt/Button.processEvent
at java/awt/Component.dispatchEventImpl
at java/awt/Component.dispatchEvent
at java/awt/EventDispatchThread.run
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic