I am reading a properties file from the Tomcat\\conf\\somename.properties directory using
String demo = System.getProperty(\"catalina.base\") +
First use the ServletContext.getServerInfo() to determine the container. Then based on the container, use container specific ways of getting the information. For e.g. if the method returns "tomcat*" then you can use catalina.base thing, if it returns glassfish, then use some glassfish specific ways, and so on.