• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

"ant list" connection refused exception

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going through the step by step Spring MVC introduction tutorial at
http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step-Part-1.html

I am able to build and deploy the application successfully but when I attempt to list the running applications I get the following exception

C:\JavaProjects\springapp>ant list
Buildfile: C:\JavaProjects\springapp\build.xml

list:

BUILD FAILED
C:\JavaProjects\springapp\build.xml:123: 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)....

I have seen other topics similar to this on this forum but none have been able to resolve my issue. Some of the other threads include
https://coderanch.com/t/108375/tools/Failed-build-InstallTask-cannot-found
https://coderanch.com/t/428039/tools/Occuring-during-interacting-Tomcat-server
https://coderanch.com/t/109089/tools/ant-list-error

and on other forums
http://forum.springsource.org/showthread.php?t=25882&highlight=connection+refused
http://forum.springsource.org/showthread.php?t=19767&highlight=connection+refused

On researching this issue, I found that a possible issue is to do with Tomcat Manager not running properly. However, I've verified that it is running i.e.
"http://localhost:8080/manager/html" takes me to the tomcat manager webpage and from there I can check e.g. server status and list applications

I can list the applications using:
"http://localhost:8080/manager/list" lists my running applications
OK - Listed applications for virtual host localhost
/springapp:running:0:springapp
/:running:0:ROOT
/manager:running:0:C:/apache-tomcat-5.5.31/server/webapps/manager
/webdav:running:0:webdav
/servlets-examples:running:0:servlets-examples
/tomcat-docs:running:0:tomcat-docs
/host-manager:running:0:C:/apache-tomcat-5.5.31/server/webapps/host-manager
/jsp-examples:running:0:jsp-examples
/balancer:running:0:balancer

My tomcat-users.xml file is:
<tomcat-users>
<role rolename="manager"/>
<role rolename="tomcat"/>
<role rolename="admin"/>
<role rolename="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="tomcat" password="tomcat" roles="admin,manager"/>
<user username="springtomcat" password="s3cret" roles="admin,manager"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>

The relevant sections in the build.xml are:
<path id="catalina-ant-classpath">
<!-- We need the Catalina jars for Tomcat -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.lib}">
<include name="catalina-ant.jar" />
</fileset>
</path>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="catalina-ant-classpath" />
</taskdef>
<target name="list" description="List Tomcat applications">
<list url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}" />
</target>

and the build.properties file is:
appserver.home=C:/apache-tomcat-5.5.31
# for Tomcat 5 use $appserver.home}/server/lib
# for Tomcat 6 use $appserver.home}/lib
appserver.lib=${appserver.home}/server/lib

deploy.path=${appserver.home}/webapps

tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=tomcat
tomcat.manager.password=tomcat

As far as I can see, everything is configured correctly but I'm new to this so maybe you guys might see something. The only thing that I can think that may be the issue is that I'm behind a firewall, but I added the following lines to the 'catalina.properties' file and I'm still seeing the same problem.
http.proxyHost=servername
http.proxyPort=8080
http.proxyUser=myusername
http.proxyPassword=mypassword

Does it matter that the proxy port is the same as the port that Tomcat is running on?

Any help would be greatly appreciated. Tearing my hair out here!

Cheers
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mike, welcome to Java Ranch!

Your post would be a lot easier to read, and thus more likely to generate responses, if you would use the 'code' tag for posting file contents.
 
Mike Kerry
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Peter, I'll make sure to do that in future. Although I didn't find a solution to my problem, I used a workaround. Some people who run into the same problem might find this useful.
I downloaded a preconfigured tomcat env from coreservlets, here
http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html

The manager interface has changed slightly in Tomcat 7 (I was previously using 5.5) so my tomcat-users.xml now looks like:


manager-script allows access to the text interface and the status pages.

I also had to make a few small changes to my build.properties file:


It worked after those changes.

Cheers
 
Normally trees don't drive trucks. Does this tiny ad have a license?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic