Hi :
I have an applet and servlet which communicate through
ObjectStreams. The servlet passes a vector to the applet after
performing a database query. The problem is that sometimes the applet
throws the InternetReadFile exception while trying to obtain the
ObjectInputStream. The stack trace is as follows :
java.io.IOException: InternetReadFile
at com/ms/net/wininet/WininetInputStream.read
at com/ms/net/wininet/WininetInputStream.read
at java/io/ObjectInputStream.read
at java/io/DataInputStream.readShort
at java/io/ObjectInputStream.readShort
at java/io/ObjectInputStream.readStreamHeader
at java/io/ObjectInputStream.<init>
at PendingCards.showPendingProjectAppraisal
at PendingCards.showDetailsCard
at MainUI.actionPerformed ..........................
The exception occurs at this point :
try
{
URL ptl = new URL("http://ip_addr:8080/servlet/ServletName");
URLConnection c = ptl.openConnection();
c.setDoOutput(true);
c.setDoInput(true);
c.setUseCaches(false);
c.setDefaultUseCaches(false);
c.setRequestProperty("Content-type","application/octet-stream");
ObjectOutputStream out = new
ObjectOutputStream(c.getOutputStream());
out.writeObject(send);
out.close();
InputStream is = c.getInputStream();
ObjectInputStream in = new ObjectInputStream(is); //EXCEPTION HERE
rv = (Vector) in.readObject();
in.close();
}catch (Exception e) {
e.printStackTrace();
}
In the servlet :
try {
in = new ObjectInputStream(req.getInputStream());
input = (Vector) in.readObject();
}catch (Exception e) {
e.printStackTrace();
}
.. // more code here...
try {
res.setContentType("application/octet-stream");
out = new ObjectOutputStream(res.getOutputStream());
if (level.equalsIgnoreCase("E")) {
out.writeObject(send);
System.out.println("sending .. " + send);
}
out.close();
in.close();
}catch (Exception e) {
System.out.println("exception " + e);
}
Has anybody encountered this problem before ? I have used the
same code at in other classes for passing vectors between servlets and
applets.It appears to be a problem with the class
com.ms.net.wininet.WininetInputStream, right ? Any suggestions ??
Thanks,
Anupama.
___________________________________________________________________________
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