Hi , I am having a serious problem trying to send an object to the NES
server using ObjectOutputStream. I create a URL for the servlet
and then set the SETDoOutput(true) on the URLConnection
object . Now I create a ObjectOutputStream from the the URLConnection
Object and write a simple string to the servlet. The
problem happens when the servlet is trying to read the Object(String). It
generates a
streamCorrupted exception as follows:
failure (16079): Internal error: exception thrown from
the servlet service function (uri=/servlet/AjayServlet):
java.io.StreamCorruptedException: Caught EOFException
while reading the stream header, Stack: java.io.StreamCorruptedException:
Caught EOFException while reading the stream header at
java.lang.Throwable.fillInStackTrace(Native Method) at
java.lang.Throwable.fillInStackTrace(Compiled Code) at
java.lang.Throwable.(Compiled Code) at
java.lang.Exception.(Exception.java:42) at
java.io.IOException.(IOException.java:47) at
java.io.ObjectStreamException.(ObjectStreamException.java:29) at
java.io.StreamCorruptedException.(StreamCorruptedException.java:30) at
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:727) at
java.io.ObjectInputStream.(ObjectInputStream.java:165)
at AjayServlet.doPost(AjayServlet.java:15) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:538) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:611) at
com.netscape.server.http.servlet.NSServletRunner.Service(Compiled
Code)
This Servlet runs fine on JavaWebServer2.0. The servlet
also runs fine if I write the string using DataInputStream from the applet
and read
it on the servlet from DataOutputStream. Iam also able
to return a String object from the server to the applet using
ObjectOutputStream
but the problem is with reading the object sent to the
servlet.
Please Help.
Thanks in advance.