wood burning stoves*
The moose likes Servlets and the fly likes java.net.ConnectException: Connection refused: connect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "java.net.ConnectException: Connection refused: connect" Watch "java.net.ConnectException: Connection refused: connect" New topic
Author

java.net.ConnectException: Connection refused: connect

Mike McMahon
Ranch Hand

Joined: May 07, 2005
Posts: 30
Hi,

I'm getting a bit out of my league here, so please forgive me if it comes out a bit jumbled.

I am running a service that spans 2 servers. Requests come into the webserver (through servlet exec), and then depending on the request, data is returned from my dataserver, and dropped into a mapped drive on the webserver. This mapped drive is also accessible to the internet, and it's content can then be accessed by a browser.

That is what is supposed to happen. The servlet I'm running has worked for numerous other organizations (so I can rule problems associated with the application itself), but most other organization are 1)using Tomcat rather than servletexec, and 2)not having their service reach across 2 servers.

The error I get is:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
at java.net.Socket.connect(Socket.java:425)
at java.net.Socket.connect(Socket.java:375)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:366)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:582)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:292)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:253)
at sun.net.www.http.HttpClient.New(HttpClient.java:321)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:301)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:463)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:454)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:556)
at GetMap.write(GetMap.java:144)
at OGCConnector.doPost(OGCConnector.java:95)
at OGCConnector.doGet(OGCConnector.java:144)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.newatlanta.servletexec.ServletExec.CallServletService(ServletExec.java:1672)
at com.newatlanta.servletexec.SERequestDispatcher.forwardServlet(SERequestDispatcher.java:274)
at com.newatlanta.servletexec.SERequestDispatcher.forward(SERequestDispatcher.java:191)
at com.newatlanta.servletexec.ApplicationInfo.processApplRequest(ApplicationInfo.java:1172)
at com.newatlanta.servletexec.ServerHostInfo.processApplRequest(ServerHostInfo.java:940)
at com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1206)
at com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1085)

Now I know that this probably isn't even a java problem, but I can barely understand the error enough to help me understand what the problem is. My gut feeling is that there is either a permissions problem across the 2 servers, or perhaps servlet exec is trying to send via a firewall-blocked port.

Does this error suggest any next steps to anyone?

Thanks for any help,

Mike
Jack Wiesenthaler
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
It just means there is no listener (server) on the other end or perhaps a firewall blocked the outgoing request.
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi,

May be some factors affect connectin to be not invoked.

1. If the other server is down
2. If the application requires some authentication


Regards,
Narendranath


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Mike McMahon
Ranch Hand

Joined: May 07, 2005
Posts: 30
Thanks to you both for your help!

Looks like I'm back to wrestling with firewalls and permissions. blech.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.net.ConnectException: Connection refused: connect