• 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
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Require Urgent Help - EOFException while making ObjectOutputStream instance

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,
firstly, I'm getting the EOFException while making ObjectInputStream instance and not ObjectOutputStream instance as mentioned in the subject matter !!
Following is the code through which I 'm trying to read object :
try {
URL AdminLoginServlet = new URL("http://something.com/servlet/AdminLogin");
URLConnection servletConnection = AdminLoginServlet.openConnection();
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setDoInput(true);
ObjectInputStream inputFromServlet = new ObjectInputStream((InputStream)servletConnection.getInputStream());
String listNames = (String) inputFromServlet.readObject();
inputFromServlet.close();
} catch(Exception e)
{
System.out.println("Exception while making servlet URL 22"+ e);
}
and following is the code through which I'm writing object :
try {
ObjectOutputStream send = new ObjectOutputStream(httpservletresponse.getOutputStream());
System.out.println("Sending user HashMap to applet...");
send.writeObject("Something");
send.flush();
System.out.println("Writing is done...");
send.close();
} catch(Exception e)
{
System.out.println("Exception here saying : "+e);
}
Writing of object is being done perfectly but while reading I'm getting the java.io.EOFException. ??? It gives me this exception even before I call readObject(), at the time when I try to create ObjectInputStream instance , why is it so ?
Can anybody let me know whats the fault ? What I have to do to read the object correctly ? Can anybody correct my code, plz...
Regards and thanx,
[This message has been edited by Sam Cala (edited June 29, 2001).]
 
Your mind is under my control .... your will is now mine .... read this tiny ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic