W3C home > Mailing lists > Public > www-jigsaw@w3.org > September to October 1999

java.net.socketException

From: Ragna-Lena&Dan <prepare.enrich@telia.com>
Date: Fri, 17 Sep 1999 23:44:43 +0200
Message-ID: <003701bf0155$da57d360$1cb8143e@dan>
To: "jigsaw <== dan" <www-jigsaw@w3.org>
I try to send a number of userdefined strings as a serialized object from
an applet to a servlet (I use Jigsaw 2.0.2 as a server on my localhost).
 
This is my code for sending the object from the applet:
           log("Connecting to servlet...");
           URL StakoDBservlet = new URL( urlStr);
           URLConnection servletConnection = StakoDBservlet.openConnection();
           log("Connected");
            
           servletConnection.setDoInput(true);
           servletConnection.setDoOutput(true);

           servletConnection.setUseCaches (false);

           servletConnection.setRequestProperty("Content-Type", "application/octet-stream");
         
           sendCustomerToServlet(servletConnection, theCustomer);
           servletConnection.connect();
 
The method sendCustomerToServlet(servletConnection, theCustomer);
 // theCustomer is the serialized object
 
looks like this:
protected void sendCustomerToServlet(URLConnection servletConnection, StakoReg theCustomer)
    {
        ObjectOutputStream outputToServlet = null;
 
        try
        {
         
         log("Sending the customer to the servlet...");
         outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
 
         outputToServlet.writeObject(theCustomer);
 
         outputToServlet.flush();
         outputToServlet.close();
         log("Complete.");
        }
        catch (IOException e)
        {
          log(e.toString());
        }
    }
 
I log "Complete" but then I get a java.net socketException
with the message 'Unexpected end of file from server'. (appletviewer)

In ie4 I reach "Sending the customer to the servlet..." and
then I get a com.ms.security.SecurityExceptionEx[StakoDBApplet.sendCustomerToServlet]
with the message 'cannot access "dan":8001'
(to reach my servlet I use the URL "http://dan:8001/servlet/StakoDBServlet";
the path "http://dan:8001/servlet/SomeServlet" runs well for other applications).
 
Please advise.
-dan
Received on Friday, 17 September 1999 17:43:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:33 GMT