2 Replies Latest reply on Jul 15, 2005 7:04 AM by avaval

    Deploying webapps outside jboss deploy/ dir

    cageot


      My software company is considering migrating from Tomcat 4 to JBoss 4, but I am stuck with a the following problem:

      For organization reasons, our webapps are located in a directory structure rooted at a SOFT_HOME directory. During the development process there can be many different SOFT_HOME directories (different versions, customers, ...) which leads to about 20 webapps which need to be deployed/undeployed when needed.
      The problem is I can't find a way to easily deploy/undeploy a webapp (exploded or not) located outside the /deploy/ jboss directory.

      With Tomcat this can easily be done by dropping/removing the appropriate xml file in the Tomcat webapps/ directory (the xml file contains a element which locates the war elsewhere on the filesystem).


      I can't find a way to use a similar feature in JBoss.

      The only solution I found is :
      * edit the conf/jboss-service.xml and add several URL file://<path_to_webapps> to the URLs attribute of the URLDeploymentScanner element.
      * rename all my webapps directory to .war

      Renaming to .war is ok (still compliant with Tomcat), but editing a comma separated list of URLs is cumbersome: you cannot use this mechanism to easily hot deploy/redeploy a webapp from one location (as in deploy/).

      Another solution would be to edit the embedded Tomcat context.xml file and add elements, but this is still not satisfying as all webapp configurations would be located in a big monolithic file (and no hot deploy/undeploy).

      So my question is: does anyone know a way of putting an xml file in the deploy/ directory which will trigger the deployment of a webapp (exploded or not) located at any given location in the file system outside the jboss deploy/ directory? (Removing the file would undeploy the war)

      I guess this file would be a jboss service but I don't know what to put in it...

        • 1. Re: Deploying webapps outside jboss deploy/ dir
          cageot

          Reposting because my xml tags were swallowed, can't find a way to post with </> using [] instead, sorry...

          My software company is considering migrating from Tomcat 4 to JBoss 4, but I am stuck with a the following problem:

          For organization reasons, our webapps are located in a directory structure rooted at a SOFT_HOME directory. During the development process there can be many different SOFT_HOME directories (different versions, customers, ...) which leads to about 20 webapps which need to be deployed/undeployed when needed.
          The problem is I can't find a way to easily deploy/undeploy a webapp (exploded or not) located outside the [conf]/deploy/ jboss directory.

          With Tomcat this can easily be done by dropping/removing the appropriate xml file in the Tomcat webapps/ directory (the xml file contains a [Context] element which locates the war elsewhere on the filesystem).


          I can't find a way to use a similar feature in JBoss.

          The only solution I found is :
          * edit the conf/jboss-service.xml and add several URL file://[path_to_webapps] to the URLs attribute of the URLDeploymentScanner element.
          * rename all my webapps directory to .war

          Renaming to .war is ok (still compliant with Tomcat), but editing a comma separated list of URLs is cumbersome: you cannot use this mechanism to easily hot deploy/redeploy a webapp from one location (as in deploy/).

          Another solution would be to edit the embedded Tomcat context.xml file and add [Context] elements, but this is still not satisfying as all webapp configurations would be located in a big monolithic file (and no hot deploy/undeploy).

          So my question is: does anyone know a way of putting an xml file in the deploy/ directory which will trigger the deployment of a webapp (exploded or not) located at any given location in the file system outside the jboss deploy/ directory? (Removing the file would undeploy the war)

          I guess this file would be a jboss service but I don't know what to put in it...

          • 2. Re: Deploying webapps outside jboss deploy/ dir

            You can have your custom jboss server deployment completely outside jboss server. The configuration described here works for JBoss 4.0.1SP1

            Try to set following parameter in start script in java command to start jboss

            Copy your jboss-service.xml to some folder say c:/foo and have complete server deployment directory structure underneath it
            e.g.
            c:/foo/config/jboss-service.xml
            |
            |_ deploy
            |
            |_.......

            Edit jboss-service.xml and search for




            Modify URL attribute as follow


            deploy/,
            file:/${custom.deploy.folder}/deploy



            Now in start script run.bat /run.sh in java command for org.jboss.Main,

            1. Give program argument as full path to jboss-service.xml file
            -Djboss.server.root.deployment.filename=c:/foo/config/jboss-service.xml

            2. Define your custom.deploy.folder as VM argument
            -Dcustom.deploy.folder="<c:/foo>"

            I hope this helps