File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "" Watch "" New topic

Pascal Lambert

Joined: Apr 05, 2002
Posts: 4
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:
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.tomcat.core.ServletWrapper.doService(
at org.apache.tomcat.core.Handler.service(
at org.apache.tomcat.core.ServletWrapper.service(
at org.apache.tomcat.core.ContextManager.internalService(
at org.apache.tomcat.core.ContextManager.service(
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(
at org.apache.tomcat.service.TcpWorkerThread.runIt(
at org.apache.tomcat.util.ThreadPool$
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());

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 ----------------
Cache-Control: no-cache
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
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
Content-Disposition: form-data; name="uploadfile"; filename="query.txt"
Content-Type: text/plain
... some data ...
... some data ...
... some data ...
Content-Disposition: form-data; name="SUBMIT"
---------- 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="" method="POST" enctype="multipart/form-data">
<table width="390" cellpadding="0" cellspacing="0" border="0">
<td class="formtext">File name:</td>
<span class="formtext"><input class="formtext" type="FILE" name="uploadfile" size=40></span>
<td height="15" width="1"><img src="/s.gif" height="15" width="1" alt=""></td>
<input class="formtext" type="submit" value="SUBMIT" name="SUBMIT">
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
Not to ask the obvious question, but are you sure still resides on that server?
Pascal Lambert

Joined: Apr 05, 2002
Posts: 4
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 ]
bill williams
Ranch Hand

Joined: Jan 15, 2002
Posts: 94
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

Yet Another SCJP2
Pascal Lambert

Joined: Apr 05, 2002
Posts: 4
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 forums).
But I still have the same problem.
[ April 09, 2002: Message edited by: Pascal Lambert ]
subbulakshmi premnath

Joined: Jun 06, 2006
Posts: 4

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.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410


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.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
jQuery in Action, 3rd edition