• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Connection refused on localhost

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I faced an annoying and strange problem, I have no more idea how to solve it.
Problem: It's is a very simple situation. An Apache Tomcat runs on my machine, it listens on 8081 port. I want to acces this URL hosted by Tomcat from Java:

http://localhost:8081/archeo/services/AdminService?wsdl

The sample code:




But it doesn't work, neither from Eclipse nor java command line. I get the following exception:

Exception in thread "main" java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:975)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:916)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1177)
at com.ind.bb.tools.URLTest.main(URLTest.java:31)

I can access this URL from any browsers. No http proxy set. Tomcat is running:

D:\programs\apache-tomcat-5.5.31\bin>netstat -a | grep 8081
TCP [::]:8081 INDNOTE2:0 LISTENING

Java version is jdk1.6.0_22, OS is Windows 7. I tried this URL's too:

http://127.0.0.1:8081/archeo/servlet/AxisServlet

Could somebody help me?
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused. You say that you want to access:

http://localhost:8081/archeo/services/AdminService?wsdl

But then you try in your code:

http://127.0.0.1:8081/archeo/servlet/AxisServlet

Then at the bottom of your post, you say you tried:

http://127.0.0.1:8081/archeo/servlet/AxisServlet

But don't say where you tried it or whether it succeeded.
 
Marshal
Posts: 28262
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Windows 7, is it? Then perhaps there's an internal firewall entry preventing anything from connecting to that port.

You could try the Telnet test: go to a command line screen and do this:

 
Rudolf Lomniczi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Tom,

Sry, I did not write enough information about call http://127.0.0.1:8081/archeo/servlet/AxisServlet url. The answer: none of URLs were successful.

Dear Paul,

I tried telnet formerly and it was successful.


But problem has been solved yesterday: I used wrong Tomcat version: I had to use 6.x instead of 5.5.31. I don't know what is the real cause, but Tomcat 6.x works fine.

Thanks for help!
 
Sheriff
Posts: 22787
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rudolf Lomniczi wrote:Sry


Sorry to nitpick, but UseRealWords: sorry.
 
Rudolf Lomniczi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All right, no problem:) I'll follow it. I'm a new user.
 
reply
    Bookmark Topic Watch Topic
  • New Topic