Hello,
This is my applet code. This code is woking in JRun. But it is not
working in bluestone server. I am getting Stream Corrupted Exception.
ObjectOutputStream toServlet = null;
ObjectInputStream objStream = null;
// Clear the previous records, if any
vectRecords = null;
numRows = numFlds = 0;
current = -1;
// Connect to the server
try {
System.out.println("before connection");
String servletName = "http://" + "attmetroajit"
+"/scripts/SaISAPI.dll/SaServletEngine.class/SaServletEngine.DataSetServlet";
URL servlet = new URL(servletName);
URLConnection con = servlet.openConnection();
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setDefaultUseCaches(false);
System.out.println("after connection");
con.setRequestProperty("Content-type", "application/octet-stream");
//
con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
// Send the request object to the server
System.out.println("SQL = " + sSQL );
toServlet = new ObjectOutputStream(con.getOutputStream());
toServlet.writeObject(sSQL);
System.out.println("after write object");
toServlet.flush();
toServlet.close();
toServlet = null;
Thanks,
Kavitha
>From: ajaikumar peddapanga <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Applet to Servlet Communication Exception
>Date: Fri, 19 May 2000 22:40:03 GMT
>
>send the code for ur applet ..
>
>
>>From: kavitha ramasamy <[EMAIL PROTECTED]>
>>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>> Servlet API Technology." <[EMAIL PROTECTED]>
>>To: [EMAIL PROTECTED]
>>Subject: Re: Applet to Servlet Communication Exception
>>Date: Fri, 19 May 2000 15:29:43 PDT
>>
>>Hello,
>>
>> I am able to connect from applet to servlet, if I use
>>DataInputStream. When I changed to ObjectStream I am getting this error.
>>I am able to send objects from servlet to applet but not from applet
>>to servlet.
>> When applet is sending some objects, I am getting stream corrupted
>>exception.
>>
>>
>>Kavitha
>>
>>
>>
>>>From: Sanjay V Mistry <[EMAIL PROTECTED]>
>>>Reply-To: [EMAIL PROTECTED]
>>>To: [EMAIL PROTECTED]
>>>Subject: Re: Applet to Servlet Communication Exception
>>>Date: Fri, 19 May 2000 17:45:22 -0400
>>>
>>>make sure, you do flush while u write and object !
>>>--
>>>
>>>On Fri, 19 May 2000 13:07:10 SUBHAPRATHA SRIDHARAN wrote:
>>> >Hello,
>>> >
>>> >Looks like your connection is working fine. Make sure the applet pass
>>>some
>>> >data before making connection to the Servlet.
>>> >
>>> >Regards.
>>> >
>>> >> > -----Original Message-----
>>> >> > From: A mailing list for discussion about Sun Microsystem's Java
>>>Servlet
>>> >> > API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
>>> >> > kavitha ramasamy
>>> >> > Sent: Tuesday, 16 May 2000 22:24
>>> >> > To: [EMAIL PROTECTED]
>>> >> > Subject: Applet to Servlet Communication Exception
>>> >> >
>>> >> >
>>> >> > Hello ,
>>> >> >
>>> >> > I am trying to make a applet to servlet communication. The
>>> >> > applet makes a
>>> >> > connection but servlet produces the following exception.
>>> >> >
>>> >> > My code is
>>> >> >
>>> >> > public void doPost(HttpServletRequest request,
>>> >> > HttpServletResponse response)
>>> >> > throws ServletException, IOException {
>>> >> >
>>> >> > ObjectOutputStream out = null;
>>> >> > Connection con = null;
>>> >> > System.out.println("Started the DataSetServlet..."+request);
>>> >> > try {
>>> >> > / Retrieve the service request
>>> >> > System.out.println("getting the stream");
>>> >> > InputStream ins = request.getInputStream();
>>> >> > System.out.println("Creating the stream "+ins);
>>> >> > //getting exception at this line
>>> >> > ObjectInputStream in = new ObjectInputStream(ins);
>>> >> > System.out.println("Reading the object");
>>> >> >
>>> >> > String sSQL = (String) in.readObject();
>>> >> > in.close(); in = null;
>>> >> >
>>> >> >
>>> >> >
>>> >> >
>>> >> > Creating the stream SaApi.servlet.SaServletInputStream@8b3a61cb
>>> >> >
>>> >> > Exception: Caught EOFException while reading the stream header
>>> >> > java.io.StreamCorruptedException: Caught EOFException while reading
>>>the
>>> >> > stream h
>>> >> > eader
>>> >> > at
>>> >> >
>>>java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:727
>>> >> > )
>>> >> > at
>>>java.io.ObjectInputStream.<init>(ObjectInputStream.java:165)
>>> >> > at SaServletEngine.DataSetServlet.doPost(Compiled Code)
>>> >> > at
>>>javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
>>> >> > at
>>>javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
>>> >> > at
>>> >> >
>>>SaApi.servlet.SaServletUtils.serviceRequest(SaServletUtils.java:532)
>>> >> > at
>>> >> >
>>>SaApi.servlet.SaServletUtils.processServletRequest(SaServletUtils.jav
>>> >> > a:633)
>>> >> > at
>>> >> >
>>>SaApi.servlet.SaServletInvokerApp.SaProcessInputStream(SaServletInvok
>>> >> > erApp.java:159)
>>> >> > at
>>> >> >
>>>SaApi.servlet.SaServletInvokerApp.handleClient(SaServletInvokerApp.ja
>>> >> > va:226)
>>> >> > at SaApi.SaApp.processRequest(Compiled Code)
>>> >> > at
>>> >> > SaApi.SaSamUbsContext.processActivator(SaSamUbsContext.java:1046)
>>> >> > at
>>> >>SaApi.SaSamUbsContext.processRequest(SaSamUbsContext.java:1383)
>>> >> > at SaApi.SaSamUbsContext.execute(SaSamUbsContext.java:1487)
>>> >> > at SaApi.SaThreadPool$Worker.run(Compiled Code)
>>> >> > at java.lang.Thread.run(Thread.java:479)
>>> >> > Closed the object stream ...
>>> >> >
>>> >> > Any help is really appreceated.
>>> >> >
>>> >> > Thanks,
>>> >> > Kavitha.
>>> >> >
>>> >>
>>> >>___________________________________________________________________________
>>> >>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
>>> >
>>> >________________________________________________________________________
>>> >Get Your Private, Free E-mail from MSN Hotmail at
>>>http://www.hotmail.com
>>> >
>>> >___________________________________________________________________________
>>> >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
>>> >
>>>
>>>
>>>Get your FREE Email at http://mailcity.lycos.com
>>>Get your PERSONALIZED START PAGE at http://my.lycos.com
>>>
>>>___________________________________________________________________________
>>>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
>>
>>________________________________________________________________________
>>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>>
>>___________________________________________________________________________
>>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
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>___________________________________________________________________________
>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
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
___________________________________________________________________________
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