1 Reply Latest reply on Jul 20, 2007 12:33 PM by peterj

    Adding configuration files to SAR deployment

    ramboid

      How can I configure a SAR deployment so that some extra files are available to the deployed application? I have a custom class that is called from a Schedulable class. The custom class looks for a cfg file in the root of JBoss. I have added the cfg file to each of the folders of the sar deployment but the custom class fails to find the cfg file unless I add it to the JBoss root folder.

      I was wondering if I can configure the jboss-service.xml file or other configuration file to make the cfg file available to the application.

        • 1. Re: Adding configuration files to SAR deployment
          peterj

          If you want to place the cfg file outside your SAR, you could use one of the jboss system properties. (http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossProperties). For example. place the cgf in server/xxx/data and locate it using the jboss.server.data.dir property.

          If you want to place the cfgfile inside your SAR, place it in a JAR (could be exploded) and access it using Class.getResource() or Class.getResourceAsStream(). For example, assume the following SAR layout:

          some.sar
          + config.jar
           + some
           + config
           + myconfig.cfg


          You can access the cfg file as follows:

          InputStream is = this.getClass().getResourceAsStream("/some/config/myconfig.cfg")