3

I am new to jboss eap 6.3. I have to load a list of configuration parameters (properties file) into a cache in my application running on jboss eap 6.3.

I checked the developers guide from red hat but did not find anything specific.

Any pointers will help.

I have this method to load properties files but not sure how it is done on server start up:

public static void loadProperties(){

  InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("test.properties");
     try {
           properties = new Properties();
           properties.load(inputStream);
     } catch (IOException e) {
            e.printStackTrace();
     }
}
Arpit Aggarwal
  • 27,626
  • 16
  • 90
  • 108
DntFrgtDSemiCln
  • 1,259
  • 2
  • 16
  • 35

2 Answers2

2

You can load your properties by keeping the property files in Module folder of server like :

Module -> com -> appName -> configuration -> main (Keep Your property file in this folder sturcture over here) then create one module.xml and put the entry for that file in module.xml.

after completing the above steps please provide the entry in deployment descriptor.xml file in inclusion(path from ur exporting the file).

Restart the server.

  • 1
    Can you provide a sample? I understand the concept but it seems to need more googling to figure out the specifics (assuming I understand correctly) :) – Franz See Sep 22 '16 at 03:05
2

Adding to the answer, create jboss-deployment-structure.xml under folder app/WEB-INF/ and add your app configuration as a module in dependencies, as follows:

app/WEB-INF/jboss-deployment-structure.xml

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.hibernate"/>
            <module name="org.javassist"/>
            <module name="com.app.configuration"/>    
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Create directory /app/configuration/main inside jboss-eap-6.4/modules/system/layers/base/com and drop test.properties in it.

Arpit Aggarwal
  • 27,626
  • 16
  • 90
  • 108