Question

when I try to undeploy an webapp in tomcat 7.0.30 using ant task, it gives me the message that

FAIL - Tried to use command /undeploy via a GET request but POST is required

But I could not find any solution for this problem.

Is my ant task is wrong? or tomcat config?

My ant task is...

<path id="catalina-ant-classpath">
    <fileset dir="${tomcat.base.dir}/lib">
            <include name="catalina-ant.jar"/>
            <include name="tomcat-coyote.jar"/>
            <include name="tomcat-util.jar"/>
    </fileset>
    <fileset dir="${tomcat.base.dir}/bin">
    <include name="tomcat-juli.jar"/>
    </fileset>
</path>

<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="catalina-ant-classpath"/>
<target name="undeploy" description="undeploy from tomcat">
    <undeploy 
            url="http://localhost:8080/manager/html"
            username="admin"
            password="password"
            path="/mywebapp"
    />
</target>

And my tomcat-users.xml is...

<user username="admin" password="password" roles="manager-gui, manager-jmx, manager-status"/>
Was it helpful?

Solution

Try using this url instead of the one ending with "html":

http://localhost:8080/manager/text

You may also need to add these roles to your user in tomcat-users.xml:

manager-script, admin-script
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top