Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT : HttpURLConnection connection refused

Status
Not open for further replies.

archit

Programmer
Aug 22, 2002
19
US
I am trying to upload a file onto the WEB server (Apache Tomcat 4.0.4) .Below is my code whic is giving me error:

URL url = new URL(webserver+"\\getXML.jsp");
String urlStr = url.toString();
System.out.println("URL::"+urlStr);
HttpURLConnection httpConn =
(HttpURLConnection) url.openConnection();

int code=httpConn.getResponseCode();
System.out.println("\n After response code");

*********************

I am getting this error :

java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at java.net.Socket.connect(Socket.java:376)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net.ion.java:481)
at sun.net.ava:472)
at sun.net.ection.java:528)
at VeritasOpps.btnUpload_mouseClicked(VeritasOpps.java:373)
at VeritasOpps$4.mouseClicked(VeritasOpps.java:274)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:208)

at java.awt.Component.processMouseEvent(Component.java:5096)
at java.awt.Component.processEvent(Component.java:4890)
at java.awt.Container.processEvent(Container.java:1566)
at java.awt.Component.dispatchEventImpl(Component.java:3598)
at java.awt.Container.dispatchEventImpl(Container.java:1623)
at java.awt.Component.dispatchEvent(Component.java:3439)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3174)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
at java.awt.Container.dispatchEventImpl(Container.java:1609)
at java.awt.Window.dispatchEventImpl(Window.java:1585)
at java.awt.Component.dispatchEvent(Component.java:3439)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThre
ad.java:197)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread
.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

Any pointer will be welcome n appreciated.

Thnks in advance
vikul
 
Hello Vikul,

Obviously when you try to access(from the same box you run the java program) the web page using a browser it works, right?

Have you checked you have the latest version of the JVM.

Regards.
 
Yes it does work with some other errors ....Can u let me know the reason for getting the connection refused error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top