I have some Web-Apps. Each in different v-hosts on Tomcat7. All this Web-Apps use the same collection of Librarys (written by my own), stored in WEB-INF/lib as .jar This Library has some static Classes (Logger, Config, etc). It seams web-app X can see/use the static Instance of web-app Y. "randomly" X writes in the logging-file of Y. Y uses configs from X.... etc.
Is this generaly a problem with the JVM(s) in Tomcat ?
Only for the Servlets i can store the static Classes in the ServletContext, but Non-Servlets cant reach them, right ?
Here the Constructor in Class Config.java
public class Config{
public static Config instance;
private Config(){
}
public static Config getInstance(){
if(instance==null) instance = new Config();
return instance;
}
}
In Servlet and also in other Classes i use
private static Config config = Config.getInstance();
Is there any other way to share ONE instance of a Class in the whole Web-App but only in THIS web-app ?