Apache Tomcat 7, ant list = BUILD FAILED

Viewed 5513

For the simple MVC springapp, I am trying to deploy the web app. "ant" and "ant deploywar" build commands work fine. It gives error when doing "ant list"

Here is the build.properties

appserver.home=/usr/local/apache-tomcat-7.0.47
appserver.lib=${appserver.home}/lib

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

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

Here is the part related to list in build.xml

<target name="list" description="List Tomcat applications">
    <list url="${tomcat.manager.url}"
             username="${tomcat.manager.username}"
             password="${tomcat.manager.password}"/>
</target> 

The manager is working in the browser and I can browse the list of applications as well

OK: http://localhost:8080
OK: http://localhost:8080/manager
OK: http://localhost:8080/manager/html
OK: http://localhost:8080/manager/html/list

and when I go to ListApplications from the HTML interface of manager, it goes to

http://localhost:8080/manager/html/list?org.apache.catalina.filters.CSRF_NONCE=BFCB46A8A1735E7DA7FBE4033D6BEC2D 

which is fine. But when I do "ant list" via terminal from the root directory of my app, it gives this error,

Buildfile: /Users/saad/Development/springapp/build.xml

list:

BUILD FAILED
/Users/saad/Development/springapp/build.xml:144: java.io.FileNotFoundException:     http://localhost:8080/manager/list
at     sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:230)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:150)
at org.apache.catalina.ant.ListTask.execute(ListTask.java:51)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds

When I changed the url in build.properties to

tomcat.manager.url=http://localhost:8080/manager/html

It returns the whole html page of the manager on doing "ant list".

or if

tomcat.manager.url=http://localhost:8080/manager/text

It gives the error:

 /Users/saad/Development/springapp/build.xml:144: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/text/list
3 Answers
Related