Question

I have a webapp in progress, i constantly need to redeploy it

I noticed that if i just deploy over the old files, it sometimes does not get updated

I went on looking for an undeployment task for me to use in my deploy script

the deploy script is working just fine, if the server is freshly started, and if its not freshly started, it sometimes doesnt overwrite the old files.

the undeploy task doesnt work at all this is my undeploy script

   <target name="undeploy" depends="clean" description="Remove application in Tomcat">
        <undeploy url="${tomcat.manager.url}"
              username="${tomcat.username}"
              password="${tomcat.password}"
              path="/${webapp.name}"/>
    </target>

and the exception i get - for some reason it turns the "/" of the context path to "%2F" and this is why i get file not found exception, how can i fix it ?

    C:\Dev\webworkspace\ElectronicArenaLenasProject\build.xml:76: java.io.FileNotFou
ndException: http://localhost:8080/manager/undeploy?path=%2FElectronicArenaLe
nasProject
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1613)
        at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalina
Task.java:230)
        at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalina
Task.java:150)
        at org.apache.catalina.ant.UndeployTask.execute(UndeployTask.java:44)
        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(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        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(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:811)
        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)
Was it helpful?

Solution

I guess tomcat is not running. Or the manager URL (that is ${tomcat.manager.url}) is not configured correctly in your build.xml

See the error message:

java.io.FileNotFoundException: http://localhost:8080/manager/undeploy?path=%2FElectronicArenaLenasProject
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top