I have a servlet deployed as a war in JBoss 4.0.2. I have a properties file for the deployed application. Where should I put this file? Under the conf directory in the jbo
If the properties file can be deployed along with the application make it part of your source tree. This will result in the properties file to be in the WEB-INF/classes folder.
This can then be read using
Properties properties = loadProperties("PropertyFileName.properties", this.getClass());
...
public static Properties loadProperties(String resourceName, Class cl) {
Properties properties = new Properties();
ClassLoader loader = cl.getClassLoader();
try {
InputStream in = loader.getResourceAsStream(resourceName);
if (in != null) {
properties.load(in);
}
} catch (IOException e) {
e.printStackTrace();
}
return properties;
}