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)....
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
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
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!
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: