java.net.ProtocolException Urgent!!

Discussions

Web tier: servlets, JSP, Web frameworks: java.net.ProtocolException Urgent!!

  1. java.net.ProtocolException Urgent!! (2 messages)

    Hi!
        When I am trying to upload a file from the server to the front end browser I am getting this error .

            Servlet request terminated with IOException java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '3582' bytes

       I am running this application on Weblogic Server 5.1.0 . This happens when the application starts writing bytes to the httpOutputStream after setting the proper headers. All this is being done to upload files from the server to the front end.

    Thanks in Advance
    Regards
    Sandeep
  2. java.net.ProtocolException Urgent!![ Go to top ]

    Sounds like the OutputStream is being closed before your servlet writes any data. It could be that the browser has the file cached from a previous download and is using the cached copy, therefore, it closes the connection to the servlet.
  3. This Exeception arises whenever the protocol of the servlet and applet are not same.You say you are uploading from server to browser but thats called downloading.Uploading is usually from client to server.
    Hope you are calling the getCodeBase from the URL constructor to frame the URL.Say you are having client file not on server.But something like a HTML file on a client PC.
    Then the protocol would differ.So this rises net.Protocol exceptions.Cheeck the Url with you are establishing connection.