Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

"ant list" connection refused exception  RSS feed

Mike Kerry
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going through the step by step Spring MVC introduction tutorial at

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


C:\JavaProjects\springapp\build.xml:123: Connection refused: connect
at Method)

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

and on other forums

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

My tomcat-users.xml file is:
<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"/>

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" />
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="catalina-ant-classpath" />
<target name="list" description="List Tomcat applications">
<list url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}" />

and the file is:
# for Tomcat 5 use $appserver.home}/server/lib
# for Tomcat 6 use $appserver.home}/lib



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 '' file and I'm still seeing the same problem.

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!

Peter Johnson
Posts: 5856
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
Posts: 2
  • Mark post as helpful
  • send pies
  • 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

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 file:

It worked after those changes.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!