- This topic has 7 replies, 3 voices, and was last updated 20 years, 3 months ago by Paul Kaiser.
-
AuthorPosts
-
Milind RaoMemberI want to pass a different properties file for different webapps.
Webapp1 wants to pass -Dconfig=c:\webapp1.preoperties.
Webapp2 would like to pass -Dconfig=c:\webapp2.propertiesHow can I do this, since the only way to pass the system property is in the JVM page for all Tomcat webapps.
Riyad KallaMemberMilind,
Currently we don’t support multiple server configs so this wouldn’t be possibly without manually editing the connector information. Multiple server configs are an important item on our TODO list, we hope to start addressing it for 3.9, but don’t have an exact ETA yet.
Milind RaoMemberOkay. Can you tell me how to do it manually in Tomcat 5? I tried the Tomcat FAQ and googling but couldn’t find it.
Riyad KallaMemberMilind,
Via the MyEclipse connector for Tomcat 5, or by way of the Tomcat startup files?If you want to do it via the Startup files, open the catalina.bat file, and look at the top. It defines a “JAVA_OPTS” environment variable that you can place extra arguments into, like the ones you have.
Milind RaoMemberUsing the Tomcat startup files. The JAVA_OPTS variable creates System Properties for all webapps. I want System Properties for a specific webapp.
Paul KaiserMemberSystem properties (System.getProperties()) has only one instance per JVM. Application specific properties must be managed by the application. I typically have a context event listener also act as an application construct. In those cases, I load a specific properties file into a private member and/or extract application properties from System.getProperties().
HTH,
Paul
Milind RaoMemberI could set up different system properties for different webapps in Websphere Application Server. I can’t recall if it was running different JVMs or not for each webapp.
Paul, I didn’t quite fiollow how you solve this problem. Are setting two different keys in the system properties for two webapps (config1 and config2) pointing to the properties file?
That approach doesn’t work for me. I have a class that looks up properties from XML properties file, key-value pair properties file and the database to create a hashmap of properties. It locates the properties file by reading the value of the “config” key in the system properties. All my applications use this class to get properties. So for webapp1 and webapp2, I need to set “config” in the system properties.
As I said, I could do this in WAS. Is there no way to do this in some deployment file in Tomcat and have the webapp run in a real or simulated JVM?
Paul KaiserMemberI’m not familiar with Websphere, but I don’t know of a way to have multiple instances of the Properties object returned from the System class.
-
AuthorPosts