----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
Hello All,
I need some help in solving this problem and I appreciate any messages in
this regard.
I am using Applet Servlet communication by http in my project. I was able to
send the data from the servlet to the JApplet, but when I try to send new
data from the applet to the servlet I am getting the following exception in
the java console of Netscape:
java.io.IOException: The document contained no data.
Try again later, or contact the server's administrator.
* at netscape.net.URLConnection.connect(Compiled Code)
at EmpListApp.sendObject(Compiled Code) at
CreateAndManageEmpList.saveBtn_actionPerformed(Compiled Code)
at CreateAndManageEmpList$12.actionPerformed(Compiled Code)
at javax.swing.AbstractButton.fireActionPerformed(Compiled Code)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Compiled
Code) at javax.swing.DefaultButtonModel.fireActionPerformed(Compiled Code)
at javax.swing.DefaultButtonModel.setPressed(Compiled Code) at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Compiled Code) at
java.awt.Component.processMouseEvent(Compiled Code) at
java.awt.Component.processEvent(Compiled Code) at
java.awt.Container.processEvent(Compiled Code) at
java.awt.Component.dispatchEventImpl(Compiled Code) at
java.awt.Container.dispatchEventImpl(Compiled Code) at
java.awt.Component.dispatchEvent(Compiled Code) at
java.awt.LightweightDispatcher.retargetMouseEvent(Compiled Code) at
java.awt.LightweightDispatcher.processMouseEvent(Compiled Code) at
java.awt.LightweightDispatcher.dispatchEvent(Compiled Code) at
java.awt.Container.dispatchEventImpl(Compiled Code) at
java.awt.Component.dispatchEvent(Compiled Code) at
java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code) at
java.awt.EventDispatchThread.run(Compiled Code) at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
Code)
In the error_log file of Apache this is the error shown:
java.io.StreamCorruptedException: Caught EOFException while reading the
stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:727)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:165)
at CreateEmplistsServlet.doPost(CreateEmplistsServlet.java:57)
at CreateEmplistsServlet.doGet(CreateEmplistsServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java)
at org.apache.jserv.JServConnection.run(JServConnection.java)
at java.lang.Thread.run(Thread.java:479)
I am using the following code to send the data to servlet:
String urlString = getDocumentBase().toString();
urlString = urlString.substring(0,urlString.lastIndexOf("/")+1)+
"servlet/"+servletName;
URL servletURL = new URL(urlString);
URLConnection servletConnection = servletURL.openConnection();
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
servletConnection.setRequestProperty("Content-Type",
"application/octet-stream");
servletConnection.connect();
ObjectOutputStream outputStmToServlet =
new ObjectOutputStream(new
BufferedOutputStream(servletConnection.getOutputStream()));
outputStmToServlet.writeObject(objToBeSend);
outputStmToServlet.flush();
outputStmToServlet.close();
}
Thanks for your time.
TIA
Srini
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search Archives:
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]