betweenGo

java.io.FileNotFoundException for valid URL

by on Sep.14, 2005, under Java SE, Programming

In one of our ATG servlet’s we were making a normal HTTP call to a page located on our ATG Dynamo server.

url = new URL(urlString);
connection = (HttpURLConnection)url.openConnection();
reader = new InputStreamReader(connection.getInputStream());

Free Daddy and His Little Shadow Girls at The Skate Park Creative Commons on FlickrHowever when trying to get the input stream we got a FileNotFoundException yet we were able to go to the same URL using a browser. Googling around we found this lovely thread about the same problem.

To summarize the thread, the problem was in our proxy settings which are set on Windows in localconfig/environment.bat and on UNIX in localconfig/environment.sh. An example of proxy settings on Windows is set PROXY_ARGS=-Dhttp.proxyHost=192.168.1.134 -Dhttp.proxyPort=8080.

The proxy server did not recognize our machines as valid clients so it rejected our requests. Once we changed the proxyHost argument to point to a valid server then this problem was fixed.

Share

Related posts:

  1. URL.equals and hashCode make blocking Internet connections
  2. Updating ATG after installing new Java SDK
  3. locallib classes not loading
  4. Playing with Dates in Java
  5. HTTP Proxy

:,

2 Comments for this entry

  • Akshay Sahu

    Sir, I am using Windows XP Professional. I wanted to know the location where I can find this environment.bat file, for proxy servers.

    Thank You.
    Akshay Sahu

  • Frank Kim

    Hi Akshay,
    The environment.bat file is located wherever ATG is installed. Typically that would be something like C:\ATG\ATG9.1\home\localconfig\environment.bat.
    Hope that helps,
    Frank

Leave a Reply

 

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!