Hi,
I am using jdk1.2 and JSDK2.1. I am using the JSDK2.1servlet runner to run the
servlets.
I am trying to call servlet from an applet. I wrote a seperate message class to
implement the Httptunneling. I am testing the message class to see if it is
writing to the servlet or not. But when I run my Httpmessage class at the server
I am getting following error on the servlet end.
HANDLER THREAD PROBLEM: java.net.SocketException: Connection reset by peer: JVM_
recv in socket input stream read
java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
eam read
at java.net.SocketInputStream.socketRead(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:90)
at java.net.SocketInputStream.read(SocketInputStream.java:106)
at com.sun.web.server.ServletInputStreamImpl.read(ServletInputStreamImpl
.java:60)
at javax.servlet.ServletInputStream.readLine(Compiled Code)
at com.sun.web.server.ServletInputStreamImpl.readLine(ServletInputStream
Impl.java:94)
at com.sun.web.server.ServerRequest.readNextRequest(ServerRequest.java:5
6)
at com.sun.web.server.ConnectionHandler.run(Compiled Code)
I am trying to send an object ( hashtable) to the servlet and just asking it to
read the received. Can anyone please help me where I am doing wrong.
The code in the message class is
if(source_type.equals("report"))
{
servletURL = new URL("http://xyz/servlet/Report_Generation");
System.out.println(" The Servlet URL is = "+servletURL);
}
if(source_type.equals("notification"))
{
servletURL = new URL("http://xyz/servlet/Notification_Generation");
}
//opening connection to the servlet to write the hashtable
URLConnection con = (URLConnection)servletURL.openConnection();
// Turn off caching
con.setUseCaches(false);
//set the content type to the java internal object which we are
//passing to the servlet.
//con.setRequestProperty("Content-Type", "java-internal/"
// + obj.getClass().getName());
con.setRequestProperty("Content-Type", "application/octet-stream");
//con.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
//set this property to true to open the connection to write the output
con.setDoOutput(true);
//open the output stream connection to the servlet
ObjectOutputStream objout = new ObjectOutputStream(new
BufferedOutputStream(con.getOutputStream()));
System.out.println(" The received object = "+objrec);
//write the object to the servlet URL
objout.writeObject(objrec);
//flush and close the output stream
objout.flush();
objout.close();
Note: I tried all three content types, it does not work
The servlet code is
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
//PrintWriter pw = response.getWriter();
Hashtable inObj = null;
//Open Input stream to receive the request sent by the Httpmessage class
try
{
ObjectInputStream result = new ObjectInputStream(new
BufferedInputStream(request.getInputStream()));
inObj =(Hashtable)result.readObject();
result.close();
Please anyone can help me. I would really appreciate any help.
did anyone have this problem before.
Thanks in advance,
saritha
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html