473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

504 error

freddieMaize
Hi all,

I used the below,
Expand|Select|Wrap|Line Numbers
  1. InputStream in = new URL ("http://127.0.0.1/search?q=travel") .openStream () ; 
I'm getting the below,
[HTML]java.io.IOException: Server returned HTTP response code: 504 for URL: http://127.0.0.1/search?q=travel[/HTML]

I've also set the proxies. Also, for your information, when i just chang the url to yahoo.com, its working fine.

Any inputs would help me.

Thanks,
fREDDIE

Out of the box question: I started a thread under networking. Is there a way to move it to somewhere else? May be here??
Nov 18 '08 #1
17 7720
JosAH
11,448 Expert 8TB
Do you have a web server or servlet container etc. running on your local host on
your default port (80)?

kind regards,

Jos
Nov 18 '08 #2
Do you have a web server or servlet container etc. running on your local host on
your default port (80)?
Hi JosAH, i'm actually using those in a standalone java program. So no servlets or web servers are in picture. Sorry i forgot to tell this in the first post.

fREDDIE
Nov 18 '08 #3
JosAH
11,448 Expert 8TB
Hi JosAH, i'm actually using those in a standalone java program. So no servlets or web servers are in picture. Sorry i forgot to tell this in the first post.
But then it can never work because you explicitly state that you want to use the
http protocol on your local host (default port 80). There is nothing listening on
that port. If you change your url to point to the yahoo site it works because
yahoo does have such a server available.

kind regards,

Jos
Nov 18 '08 #4
But then it can never work because you explicitly state that you want to use the
http protocol on your local host (default port 80). There is nothing listening on
that port. If you change your url to point to the yahoo site it works because
yahoo does have such a server available.
I would again apologies. Oh god why am i doing this.

The actual url that i used was something like below,

Expand|Select|Wrap|Line Numbers
  1. InputStream in = new URL ("http://Anothermachine/search?q=travel") .openStream () ;  
To make sure that i dont show up the ip of the server machine that i use (just to be on the safer side) i gave localhost. My mistake.

fREDDIE
Nov 19 '08 #5
r035198x
13,262 8TB
The same question that you were asked by Jos holds for that other machine of yours. If there is a server running there then make sure there are no security restrictions blocking access to the port you are trying to get to.
Nov 19 '08 #6
The same question that you were asked by Jos holds for that other machine of yours. If there is a server running there then make sure there are no security restrictions blocking access to the port you are trying to get to.
Hi, But the url is accessible from my machine if i use it in the address bar. That is how we check if the server is up right? Kindly correct if i'm wrong.

I'll put it in simple terms. If a url works in my browser then obviously i should be able to use that url in my application right?

fREDDIE
Nov 19 '08 #7
r035198x
13,262 8TB
Hi, But the url is accessible from my machine if i use it in the address bar. That is how we check if the server is up right? Kindly correct if i'm wrong.

I'll put it in simple terms. If a url works in my browser then obviously i should be able to use that url in my application right?

fREDDIE
OK then. It's purely a timing out issue then. When you try from the browser, you put exactly the same url as the one in the code right?
Nov 19 '08 #8
OK then. It's purely a timing out issue then. When you try from the browser, you put exactly the same url as the one in the code right?
Exactly the same. In fact i used ctrl+c and ctrl+v.
Nov 19 '08 #9
r035198x
13,262 8TB
Exactly the same. In fact i used ctrl+c and ctrl+v.
Just trying to eliminate another doubt with your proxy ...

Instead of openStream(), try using openConnection(aProxy).getInputStream();
For the aProxy part, first try Proxy.NO_PROXY. If that doesn't work then try creating a Proxy object using your proxy settings and use that instead.
Nov 19 '08 #10
Just trying to eliminate another doubt with your proxy ...

Instead of openStream(), try using openConnection(aProxy).getInputStream();
For the aProxy part, first try Proxy.NO_PROXY. If that doesn't work then try creating a Proxy object using your proxy settings and use that instead.
:( Unfortunatly that is also resulting the same. Below is the code with the latest changes,

Expand|Select|Wrap|Line Numbers
  1. System.getProperties().put("proxySet", "true");
  2.     System.getProperties().put("proxyHost", "proxy");
  3.     System.getProperties().put("proxyPort", "80"); 
  4.  
  5.         URL yahoo = new URL("http://172.16.1.21/search?q=travel");
  6.         URLConnection yc = yahoo.openConnection();
  7.         BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
I'm wondering why this 504 is comming.

fREDDIE
Nov 19 '08 #11
r035198x
13,262 8TB
Try setting the proxy like I suggested without setting any System properties. See my post above again.
Nov 19 '08 #12
Try setting the proxy like I suggested without setting any System properties. See my post above again.
The below is what you were trying to say right?

Expand|Select|Wrap|Line Numbers
  1. SocketAddress addr = new InetSocketAddress("myProxy", 80);
  2.     Proxy proxy = new Proxy(Proxy.Type.HTTP, addr);
  3.  
  4.     URL url = new URL("http://ServerMachine/search?q=travel");
  5.     URLConnection yc = url.openConnection(proxy);
  6.     BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
I initally tried with no proxy also, but then it dint work.

At end of all these attempts i'm still facing the same 504 error.

r035198x, is there anything else i'm missing from what you suggested?

fREDDIE
Nov 20 '08 #13
I initally tried with no proxy also, but then it dint work.
OOPSSSS.... its working... working when i use Proxy.NO_PROXY... Thanks man.

fREDDIE
Nov 20 '08 #14
I initially tried with no proxy also, but then it dint work.
OOPSSSS.... its working... working when i use Proxy.NO_PROXY... Thanks man.
...without setting any System properties...
By the way, any simple reason or explanation for why it was not working with System properties and why it was working with Proxy.NO_PROXY. Just to know i'm asking

fREDDIE

sorry for the typo
Nov 20 '08 #15
r035198x
13,262 8TB
..
By the way, any simple reason or explanation for why it was not working with System properties and why it was working with Proxy.NO_PROXY. Just to know i'm asking

fREDDIE

sorry for the typo
I am actually curious as to why you thought what you did with the System properties works.
Nov 20 '08 #16
I am actually curious as to why you thought what you did with the System properties works.
The same curiosity was there with me also :). I'm not using my PC. Hence I didn’t know the LAN settings (unfortunately missed). And to access the 'ServerMachine' no internet proxy is needed it seems. So the ip of the 'ServerMachine' was listed in the "Do not use proxy for..." list in the internet options.

So why initialy i went for System.properties.

fREDDIE
Nov 20 '08 #17
r035198x
13,262 8TB
Why did you think that openConnection looks for a System property called "proxy"? Also, if you read the API specs for the System class you will see that "proxy" is not a property guaranteed to be always available.
Nov 21 '08 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
1
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly,...
0
by: mchuc7719 | last post by:
Hello, I have a Vb.Net 2005 ClassLibrary, when I try to compile using MSBee, only get errors. Before I to run the command line, I open in notepad the .vbproj and I was add the next line: ...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.