6 Replies Latest reply on Jun 13, 2006 10:58 AM by Peter Johnson

    Undeploy exploded web app

    Nick de Graeve Newbie

      I have a web application as a directory. How can I undeploy it?

      Let me explain: I use ant to build, pack, sign our web app and then copy the dir to the JBoss deploy dir. To ensure that no old stuff remains I want to delete the existing dir first. However, some JARs in WEB-INF/lib can't be deleted.
      When the application is packed in a WAR it's easy, I can just delete the archive but I really need the exploded version.

      So how can I undeploy/delete the directory?

        • 1. Re: Undeploy exploded web app
          chris griffith Expert

          Nick,

          If ant just overwrites the changed files, I think deployer will see the difference, undeploy the application, then redeploy. So you do not have to delete entire directory.

          cgriffith

          • 2. Re: Undeploy exploded web app
            Nick de Graeve Newbie

            Yes, but when you copy, files/dirs that aren't needed anymore, will not be deleted, they just remain. That's why I need to delete my entire app.war/ directory.

            • 3. Re: Undeploy exploded web app
              Peter Johnson Master

              Nick, you state that some jar files cannot be deleted. Is that because they are in use? If so, the most likely cause is that the app server is holding on to session information for sessions that have not yet timed out.

              Try this. Set the session-timeout in web.xml to a low number, like 1. Then deploy the the web.xml file. This should cause JBoss to redeploy the app. Wait about 5 seconds (the default time used by hot-deploy, adjust if you changed that time), and then try deleting the directory. Try it by hand first, and if it works, it should be fairly simple to teach ant how to do this.

              • 4. Re: Undeploy exploded web app
                Nick de Graeve Newbie

                It doesn't seem to work.

                I added

                <session-config>
                 <session-timeout>1</session-timeout>
                </session-config>
                to web.xml; the app was redeployed. I waited long enough to make it time out and then I tried to delete the dir: the JARs are still in use.

                The web app is one for Web Start with in WEB-INF/lib jardiff.jar, jnlp.jar, jnlp-servlet.jar and one of mine. None of them can be deleted.

                • 5. Re: Undeploy exploded web app
                  chris griffith Expert

                  Lets try to start over on this topic.

                  You have an exploded war. You want to be able to undeploy the applicaiton, make changes to the content of this war, then redeploy, correct?

                  However, you do not want to delete some jar's, correct? please explain why you can't just delete the old war directory. I am missing something about your environment that does not make sense, that is why I need you to explain this.

                  thanks, cgriffith

                  • 6. Re: Undeploy exploded web app
                    Peter Johnson Master

                    OK, let's try something else. Try undeploying your application via the undeploy method on the jboss.system:service=MainDeployer mbean. The undeploy method takes a URL, which you can find using the listDeployedURLs method in the jboss.deployment:flavor=URL,type=DeploymentScanner mbean. Do this manually using the jmx-console, and then see if you can delete the jar files. If that works, the above steps can be scripted in ant, though the script is a little more unusual.