3 Replies Latest reply on Jan 18, 2007 10:47 AM by Peter Johnson

    Tomcat to JBoss Conversion - tomcat context files

    Don Sloth Newbie

      Currently we have some apps deployed to Tomcat and are working on migrating those apps to JBoss. Currently all of our web applications are running on Tomcat. I have a question about how to replicate a useful Tomcat configuration in JBoss.

      In our CATALINA_BASE/conf/Catalina/localhost directory we are making use of context files on our development instances to greatly simplify the development process. Here is an example of one of the files that we have in the conf/Catalina/localhost directory.

      <Context docBase="C:\data\dev\code\myApp\target\myApp"
       reloadable="true"
       privileged="true"
       antiResourceLocking="false"
       antiJARLocking="false">
       <WatchedResource>WEB-INF/web.xml</WatchedResource>
       <WatchedResource>WEB-INF/config/struts/struts-config.xml</WatchedResource>
       <WatchedResource>META-INF/context.xml</WatchedResource>
      </Context>
      


      This effectively causes Tomcat to load the application from the docBase directory rather than actually deploying the war file to the webapps directory. This is very useful in our web application development as we can then use maven to do things like run maven war:war-resources to copy a changed jsp file while the application is live to try out a new jsp file. This is much much faster than copying the war file to the webapps directory. I have been unsuccessful in getting this to work in JBoss.

      Is there a section of the Knowledge Base or manual that explains how to set something like this up?

      Any help is greatly appreciated.

      Thanks.

        • 1. Re: Tomcat to JBoss Conversion - tomcat context files
          Peter Johnson Master

          Two possibilities.

          First, maybe exploded directories would help you. See http://wiki.jboss.org/wiki/Wiki.jsp?page=ExplodedDeployment. Since the war is a directory tree rather than a file, it is easy to replace or add files without restarting the whole app.

          The other possibility is to add new directories to the main deployment scanner. You can do this via the "URLs" attribute on the jboss.deployment:type=DeploymentScanner,flavor=URL MBean defined at the end of server/xxx/conf/jboss-service.xml file.

          • 2. Re: Tomcat to JBoss Conversion - tomcat context files
            Don Sloth Newbie

            Thanks PeterJ for the reply. I have tried the URLs attribute approach unsucessfully. It seems like it thinks that my war is corrupted or something. I get an error about the ZipFile being incorrect or unable to unzip the file or something like that.

            However, the ExplodedDeployments approach seems to be working good. I have some more testing to do but that looks like the approach that we will go with.

            Thanks again for the assistance.

            • 3. Re: Tomcat to JBoss Conversion - tomcat context files
              Peter Johnson Master

              Zip file corruption errors typically happen if the hot deployer attempts to deploy the war file before it is completely copied to the deploy directory (or the directory you added to the URLs attribute). To avoid zip file-related errors, you should copy your war file to a temporary location on the same disk partition as the target directory (deploy, or one specified by URLs), and then move the file to the deploy directory.

              But as you noted, exploded directories are really the way to go for what you want to do.