I am trying to load a properties file in a web application using the following code in Java.
InputStream in = ContextEventListener.class.getResourceAsStream(resourceConstVal);
Properties config = new Properties();
config.load(in);
When this application runs on tomcat server; all the properties specified in the properties file get exported as system variables and are accessible via the following code
System.getProperty("TEMP")
`
However, when the same application ran on Jboss server; the properties had to be explicitly exported by
Set<Object> keySet = config.keySet();
for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
String strVal = (String) iterator.next();
System.setProperty(strVal, config.getProperty(strVal));
}
Using JDK 1.6 , Tomcat 7.0 , Jboss AS 6.1.
Content of Property File
CONTENT_DIR=XXXXXX
RESPONSE_FILE_NM=YYYYYYYY
REQUEST_INT_FILE_NM=ZZZZZZZ
Wondering why behavior varies in different application server.