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

Connection Refused Error


Joined: Jun 14, 2002
Posts: 1
I am trying to connect to an xml file on HTTP server through Java Application using following code.
URL url = new URL("http://***.***.**.**:4319/***.xml");

is = url.openStream();
InputSource xmlFile = new InputSource(is);
catch (FileNotFoundException fnfe)
if (fnfe.getMessage() == null)
catch (SAXException saxe)
if(is != null)
This code has been working for more than a year.
But recently I found a strange problem.
I am getting "Connection refused" from this code
but I can connect to the xml file from browser.
Does anybody have any idea?
[ June 14, 2002: Message edited by: supriya_s ]
Joselito El Gallo

Joined: Oct 16, 2003
Posts: 2
I�m having the same problem with similar code.
My application works fine in JBoss but receive the same error (Connection refused) in the same point when i deploy it in SAP portal... I have changed the way i get the xml file by using a Fileinputstream class and asking the servletcontext for the real path where my xml file is placed instead of getting it using the URL and an "" class... It fixes the problem for SAP portal but it fails for Jboss... Probably in JBoss i�m not getting the right real path.. but anyway.. my question is:
Is it possible that some app servers refused a connection to them made by one of the applications they hold due to any kind of security reasons?
Thanks a lot in advance
(in Spanish/En espa�ol)
Tengo el mismo problema con un c�digo similar.
Mi aplicaci�n funciona correctamente en JBoss pero recibo el mismo error (Connection refused) en el mismo punto cuando la despliego en SAP portal. He cambiado la forma de obtener el fichero xml usando la clase FileinputStream y preguntando al contexto del servlet por la ruta f�sica real donde est� mi fichero xml en vez de usar una url y la clase "" para obtenerlo. Esta soluci�n arregla el problema en SAP portal pero no funciona en JBoss... Probablemente no estoy obteniendo el path correcto en JBoss, pero en cualquier caso la pregunta es:
Es posible que algunos servidores de aplicaciones rechacen una conexi�n �sobre ellos mismos hecha por una aplicaci�n que ellos mismos tienen instalada por alg�n motivo de seguridad?
Muchas gracias por adelantado.

"Nationalism is a disease you cure by traveling"<p>Miguel de Unamuno
I agree. Here's the link:
subject: Connection Refused Error
It's not a secret anymore!