wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Author

File not found exception for a valid URL

subbulakshmi premnath
Greenhorn

Joined: Jun 06, 2006
Posts: 4
Hi,

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
java.io.FileNotFoundException: https://xxx
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getInputStream([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getHeaderField([DashoPro-V1.2-120198])
at com.stc.eways.http.HttpClientAPI.getResult(HttpClientAPI.java:1179)
at com.stc.eways.http.HttpClientAPI.doGet(HttpClientAPI.java:1158)
at com.stc.eways.http.HttpClientAPI.get(HttpClientAPI.java:771)
at com.stc.eways.http.HttpClient.get(HttpClient.java:1447)
at crPAYNET_HTTP_to_eGate_INVPDF_001.executeBusinessRules(crPAYNET_HTTP_to_eGate_INVPDF_001.java:195)
at com.stc.jcsre.JCollaboration.translate(JCollaboration.java:144)
at com.stc.common.collabService.JCCollabControllerImpl.translate(JCCollabControllerImpl.java:518)

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 = "";
try
{
surl = schemaProps.getProperty("EBPP.CustURL");
sFetchMode=schemaProps.getProperty("EBPP.FETCHMODE");
if(sFetchMode.equals("")) sFetchMode="TOFETCH";

if((schemaProps.getProperty("EBPP.REVOKEVENO")).equals("NO")) bRevokeCheck=false;
else
bRevokeCheck=true;
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)
{
sFetchMode="TOFETCH";
bRevokeCheck=true;
iRetryVal =3;
surl=schemaProps.getProperty("EBPP.CustURL");
itosleep = 300000;
}
finally
{
}
if (bGet)
{
int iListGetCounter = 0;
for( ;iListGetCounter< iRetryVal;iListGetCounter++)
{
getetiHttpIn().setURL(surl.trim()+"/getshipmentlist.eval?REQUEST=FetchMode%3D" + sFetchMode);
getetiHttpIn().get();
break;
}

Can someone provide me with a solution for this.

Thanks,
Subbulakshmi.
Ben Souther
Sheriff

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
Greenhorn

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
hi,
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.

pawan
subbulakshmi premnath
Greenhorn

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File not found exception for a valid URL
 
Similar Threads
Public key not of type RSA -exception
HTTPSURLConnect and JSSE
untrusted server cert chain..please help!!
HTTPSURLConnection and JSSE
HTTPSURLConnection/JSSE