permaculture playing cards
The moose likes Servlets and the fly likes File not found exception for a valid URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "File not found exception for a valid URL" Watch "File not found exception for a valid URL" New topic

File not found exception for a valid URL

subbulakshmi premnath

Joined: Jun 06, 2006
Posts: 4

I am trying to connect fetch a file from a secure URL and I am getting the following exception. Can someone please help me to get a solution for this.

The same URL can be opened through IE and the file can be retrieved.
I am also getting a Server Response OK when tried to do a Client Hello.
I am replacing the URL with xxx as I will not be able to give it out.

We are able to https://xxx
at crPAYNET_HTTP_to_eGate_INVPDF_001.executeBusinessRules(

The piece of code for fetching the files from the URL is as follows>

public boolean executeBusinessRules() throws Exception
boolean retBoolean = true;
boolean bGet = true;
int iRetryVal = 3;
String surl = "";
int revokok = 0;
int itosleep = 300000;
String CountryName = "";
String strBpidIref = "";
surl = schemaProps.getProperty("EBPP.CustURL");
if(sFetchMode.equals("")) sFetchMode="TOFETCH";

if((schemaProps.getProperty("EBPP.REVOKEVENO")).equals("NO")) bRevokeCheck=false;
RetryCountVal = schemaProps.getProperty("EBPP.RETRYCOUNT");
if(RetryCountVal .equals("")) RetryCountVal ="3";
iRetryVal = Integer.parseInt(RetryCountVal);

String strtosleep = schemaProps.getProperty("EBPP.SleepBforNxtTry");
if(strtosleep.equals(""))strtosleep = "15000";

itosleep = Integer.parseInt(strtosleep);
catch(Exception e)
iRetryVal =3;
itosleep = 300000;
if (bGet)
int iListGetCounter = 0;
for( ;iListGetCounter< iRetryVal;iListGetCounter++)
getetiHttpIn().setURL(surl.trim()+"/getshipmentlist.eval?REQUEST=FetchMode%3D" + sFetchMode);

Can someone provide me with a solution for this.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

If this were my problem, the first step I would take would be to fire up a browser on the machine where the application resides and try to hit the link for the file that can not be found.

If you app is using https, make sure you also do so from the browser.

If you can't download the file with a browser, then you know you have a problem with your network or firewall.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
subbulakshmi premnath

Joined: Jun 06, 2006
Posts: 4
Hi Ben,

I tried opening the same URL through IE and I am able to get the file. The problem arises when I try to get the file. I am facing the same issue when I try to post the file to a different secure site which resides in the same server as the first one.
pawank gupta
Ranch Hand

Joined: Jun 07, 2006
Posts: 34
As i think when u tried to access any data from a secure server u need to be a trusted client for that sever. when u approved as trusted for that secure server then only u can access that server programmeticaly. n about direct access through the browser this condition does not apply.

subbulakshmi premnath

Joined: Jun 06, 2006
Posts: 4
Hi Pawan,

Thank you for your suggestions.
I agree with what you are saying. I have the certificates, public key(trust store) and private key(keystore) with which I am trying to access the secure site.
When I tried to run a client tester(general java HTTP client tester), I am getting 'OK' as the response from the server. I believe this means i am connected as a trusted client.

Can you kindly let me know if you have any other suggestions also.
I agree. Here's the link:
subject: File not found exception for a valid URL
It's not a secret anymore!