Hi,
    I am facing a crazy problem and its driving me nuts...  I
have developed an applet, which calls servlets to get the data
from db2. I have tested the applet in the appletviewer,
and it works smoothly.
       The problems started once I started testing it in the
browser (IE 4.0) . It still runs smoothly (in the browser), on
my machine where the servletrunner is also running But
when I test it on other PCs (IE 4.0 again), it throws an
exception : InternetReadFile exception. I have not been
able to find any explanation for it in the Java documentation.
It throws this exception when I read the object being passed
from the servlet. It gets the ObjectInputStream without any
exception.  the code is as below :

public Vector executeQuery(String servlet, Vector send) {
        try
        {
            URL ptl = new URL(url + servlet);
            URLConnection c = ptl.openConnection();

            c.setDoOutput(true);
            c.setDoInput(true);

            ObjectOutputStream out = new
ObjectOutputStream(c.getOutputStream());
            out.writeObject(send);

            ObjectInputStream in = new
ObjectInputStream(c.getInputStream());
            rv = (Vector) in.readObject();  // exception here

            in.close();
            out.close();
        }catch (Exception e) {
            System.out.println("Exception: " + e);
        }

        if (rv == null) {
            JOptionPane.showMessageDialog(null, "Error in
Mainframe access");
            System.out.println("error : rv is null");
            error = true;
            return null;
        }
    }

     In the servlet, I print the vector contents just before
writeObject(reply), the data is properly displayed. here is the
servlet code :

        try {
            ObjectInputStream in = new
ObjectInputStream(req.getInputStream());
            input =  (Vector) in.readObject();
            in.close();
        }catch (Exception e) {
            System.out.println("exception " + e);
        }

    // database access operations

          try {
            ObjectOutputStream out = new
ObjectOutputStream(res.getOutputStream());
          System.out.println("reply = " + reply); // data seen
correctly
            out.writeObject(reply);
            out.close();
        }catch (Exception e) {
            System.out.println("exception " + e);
        }
    }
       This behavior is unpredictable. Sometimes, the first call
to the servlet goes off smoothly, it gives problems second or
third call onwards. Its just driving us crazy...  Please help us
out with this problem.. any suggestions are welcome...
  Thanking you, in anticipation,

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

Reply via email to