Version 8

    Configuring the Deployment Scanner in conf/jboss-service.xml




    The conf/jboss-service.xml file is described here.  There are a number of changes that can be made to the default DeploymentScanner that will greatly affect the operation of the JBoss Application Server's hot deployment features.  As with all changes to conf/jboss-service.xml, you will need to restart JBoss for them to take effect.  If you wish to make runtime changes you should use the JMXConsole.  Instructions for configuring the deployment scanner via the JMXConsole can be found here.


    First steps


    Open the conf/jboss-service.xml in vi or some text editor capable of saving in plain text.  Scroll near the bottom to the MBean definition for the DeploymentScanner:


       <!-- ==================================================================== -->
       <!-- Deployment Scanning                                                  -->
       <!-- ==================================================================== -->
       <!-- An mbean for hot deployment/undeployment of archives.
       <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"


    This constitutes the MBean name for the deployment scanner.  You should, of course, not change this unless you have a good reason.   


    Deployment Sorter


    As you scroll down you should see some comments followed by this:


          <attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute>


    This is the deployment sorter which enforces the DefaultDeploymentOrder. Starting from 4.0.1, it gets the sort order from the MainDeployerss EnhancedSuffixOrder.  If you prefer a UNIX System-V init style you can comment this sorter and uncomment the following line:


          <attribute name="URLComparator">org.jboss.deployment.scanner.PrefixDeploymentSorter</attribute>


    This sorter will use a numeric prefix-based order.  If you wish to use this sort, you should read further on the PrefixDeploymentOrder.


    Scan Period


    As you scroll further you will find:


          <attribute name="ScanPeriod">5000</attribute>


    The default value is 5000 milliseconds or 5 seconds.  This determines how frequently the directories which the Deployment Scanner is watching (/deploy) will be polled.  Setting this to a larger value will mean that changes to the /deploy (or others) will be noticed less frequently where setting this lower will probably waste CPU cycles needlessly.




    As you scroll further you will find:


          <attribute name="URLs">


    As noted, this is a comma seperated list of URLs which will be used for hot deployment.  These CAN be HTTP server URLs, however, you should use a WebDAV enabled server.  You can scan multiple directories with different permissions.  For example, if you wanted to protect the database passwords you might do this:


          <attribute name="URLs">


    You could set the file system permissions on datasources/ such that JBoss could read them, but developers could not.




    Finally, you should see:


          <attribute name="RecursiveSearch">True</attribute>


    This will cause the deployment scanner to recurse into subdirectories.  Read this for more informaton on the drawbacks.


    Disable Hot Deployment


    Add the following attribute:

          <attribute name="ScanEnabled">false</attribute>




    Referenced by: