2 Replies Latest reply on Mar 16, 2015 6:47 PM by jamesedler

    Where to keep External mycustom.properties file in Wildfly 8.2.0Final while migrating form Jboss4.2.3 server/default/conf

    jamesedler

      Hi Community Members.

       

      I have an application, which refers to a mycustom.properties file which has some key value pairs. which needs to be external to the ear, war or jars deployed on my wildfly. Earlier  in Jboss 4.2.3. we use to just drop these files inside the file path server\default\conf

       

      I was thinking may be the same would work in the wildfly 8.2.0 Final  file path  wildfly-8.2.0.Final\standalone\configuration , looks like that as per the documentation we are not suppose or we cannot  place any properties file which is needed by the deployment jar, ear or war. instead we have to pack it and place it as per the rule below provided on the wildfly8.2.0 Final documentations.

       

      Quoting from WildFly Documentation Reference link

      "Change ResourceBundle location

      In previous versions of AS, the JBOSS_HOME/server/<servername>/conf/ was available in the classpath. Hence the properties files in that location were available in the classpath of the application. In WildFly 8, to get those properties available in the classpath, package them within your application. For example, if you are deploying a .war then package those properties in WAR WEB-INF/classes/ folder. If you want those properties accessible to all components in a .ear, then package them at the root of some .jar and place that jar in EAR lib/ folder"

       

      it will be great help if someone can tell me cleaner way of keeping the properties file external to the ear/jars.

       

      Thanks in advance.

       

      James

        • 1. Re: Where to keep External mycustom.properties file in Wildfly 8.2.0Final while migrating form Jboss4.2.3 server/default/conf
          sanjay05222

          Hi James ,

           

          The process of externalizing the properties can be done by following below mentioned steps

           

          1. Create and populate the module/ directory structure.
            1. Create a directory structure under the JBOSS_HOME/module directory to contain the files and JARs. For example:
              1. $ cd EAP_HOME/modules/
              2. $ mkdir -p myorg-conf/main/properties
            2. Move the properties files to the JBOSS_HOME/modules/myorg-conf/main/<properties-folder>/ directory you created in the previous step.
            3. Create a module.xml file in the JBOSS_HOME/modules/myorg-conf/main/ directory containing the following XML:

           

                    <module xmlns="urn:jboss:module:1.1" name="myorg-conf">

                        <resources>

                            <resource-root path="properties-folder"/>

                        </resources>

                    </module>

           

          PS: Important thing it is little different than jars where modules are there. jars are kept immediately under the "main" or "slot number" named folders but here the module.xml and properties files are not at the same level. ( I am not sure if really it matters)

          There can be one or more properties file(s) but one don't have to mention all the files in the module.xml files explicitly, just have to mention the top folder (properties_folder) where all properties file are under the main


          More Details Refer Document Link

           

          Sanjay Gautam

          • 2. Re: Where to keep External mycustom.properties file in Wildfly 8.2.0Final while migrating form Jboss4.2.3 server/default/conf
            jamesedler

            Thanks for the reply and looks like that the steps mentioned works fine , do you have Idea if I can load applicationContext file of spring from any of similar settings as my application is earlier has Jboss 4.2.3. where we use to drop the applicationContext.xyz.xml and that use to get loaded into the system  and using the jars and wars it use to wire the application together. but I am not sure how I can do the same thing in wildfly 8.2.0Final version . If any one or you can help me to find out the details it will be great.

             

            thanks

            James