Hi,
I'm facing the following problem;
One year ago I'd develop a
servlet which emulate the process off posting data one a secure web site (wich was done manually before). The servlet run's many times per day everyday. But since March 28, the servlet stop to work. We have been later noticed that the program that handle our request had change but nobody can tell us what the change are. Initialy my servlet was not conform to RFC1867 (wich define posting with multipart/form-data). But now it is. The company wich maintain the web site still have the old version available. I've
test the new release of my servlet on the old site and it still working on it. The error I'm getting now is the folling one the new web site is the folling:
java.io.FileNotFoundException:
https://bidpost.nyiso.com/cgi-bin/main.exe at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getInputStream([DashoPro-V1.2-120198])
at com.hydroquebec.mz.nyiso.bidpost.BidpostServlet.doQueryBidpost(BidpostServlet.java:294)
at com.hydroquebec.mz.nyiso.bidpost.BidpostServlet.queryBidpost(BidpostServlet.java:223)
at com.hydroquebec.mz.nyiso.bidpost.BidpostServlet.doGet(BidpostServlet.java:134)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
This error occurs when I try getting the inputStream (HttpsURLConnection.getInputStream).
When we do it manually using IE it's working.
Those anybody have a clue of wich situation might generate a FileNotFoundException?
Following is more detail of the code and other usefull information.
Java -version
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
JSSE 1.0.2
Tomcat 3.2
------ Part of the source -----
// Definition of in and out.
BufferedOutputStream out;
BufferedReader in;
... other out.write command ...
out.write(boundary.toString().getBytes()); out.write("--".getBytes());
out.write("\r\n".getBytes());
out.flush();
try {
in = new BufferedReader(new InputStreamReader(http.getInputStream())); // this is line 294
} catch(FileNotFoundException e) {
if (http.getErrorStream() != null)
in = new BufferedReader(new InputStreamReader(http.getErrorStream()));
else {
System.out.println("FileNotFoundException and no ErrorStream().");
throw e;
}
}
... still more code
Here is the detail of my HTTP request wich now conform to RFC1867.
------------- begin here ----------------
POST / HTTP/1.1
Cache-Control: no-cache
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Referer:
https://bidpost.nyiso.com/upload.html Content-type: multipart/form-data; boundary=---------------------a3b24
Host: localhost:8088
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-length: 349
---------------------a3b24
Content-Disposition: form-data; name="uploadfile"; filename="query.txt"
Content-Type: text/plain
... some data ...
... some data ...
... some data ...
---------------------a3b24
Content-Disposition: form-data; name="SUBMIT"
SUBMIT
---------------------a3b24--
---------- end here ------------------
Note that the "Host" parameter is not the good one. "localhost:8088" is a program that echo my query.
Part of the original web page (when we have to do it manually)
<form name="uploadForm" action="https://bidpost.nyiso.com/cgi-bin/main.exe" method="POST" enctype="multipart/form-data">
<table width="390" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="formtext">File name:</td>
</tr>
<tr>
<td>
<span class="formtext"><input class="formtext" type="FILE" name="uploadfile" size=40></span>
</td>
</tr>
<tr>
<td height="15" width="1"><img src="/s.gif" height="15" width="1" alt=""></td>
</tr>
<tr>
<td>
<input class="formtext" type="submit" value="SUBMIT" name="SUBMIT">
</tr>
</table>
</form>