• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

java.io.FileNotFoundException

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not to ask the obvious question, but are you sure https://bidpost.nyiso.com/cgi-bin/main.exe still resides on that server?
 
Pascal Lambert
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it is!
I can send my data one the target server throw IE and Netscape.
Has a complementary information, if i comment the code that write to the server (comment the getOutputStream and all the out.write stuff), I don't have the FileNotFoundException (but an error from the server which is normal since I didn't send data ;-) ).
[ April 05, 2002: Message edited by: Pascal Lambert ]
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just had the same problem yesterday, and found the solution after 4 hour debugging.
do you know the real ip address of the machine hosting the "main.exe"? if so, try to use ip address instead of domain name. I believe it is bug. let me know if this works
 
Pascal Lambert
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I know the IP adress but I can't use it whitout involving another problem. It happen that I'm trying to connect on a secure website (with certificate authentication) and if I tried to connect with the IP adress instead of domain name, I get an error saying that the server is untrusted (the server certificate I have is build with the domain name). I've saw somewhere code that seem to bypass the the validation of the server certificate (wich in my case would be acceptable) but I don't have this code. So until I found a way to counter this problem I cannot use the IP address.
I found a way to counter it (I found the code on java.sun.com forums).
But I still have the same problem.
[ April 09, 2002: Message edited by: Pascal Lambert ]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am facing a similar issue when trying to access a secure URL. Can some oe help me if you have a resolution for the issue.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
subbulakshmi,

This is a very old thread.
Chances are, everyone who's posted to it has moved on.
Also the technologies used have probably been upgraded since this problem occured.

Your best bet is to start a new thread with a thorough description of your problem.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic