facebook

Setting System Properties per webapp [Closed]

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #214747 Reply

    Milind Rao
    Member

    I 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.properties

    How can I do this, since the only way to pass the system property is in the JVM page for all Tomcat webapps.

    #214784 Reply

    Riyad Kalla
    Member

    Milind,
    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.

    #214853 Reply

    Milind Rao
    Member

    Okay. Can you tell me how to do it manually in Tomcat 5? I tried the Tomcat FAQ and googling but couldn’t find it.

    #214855 Reply

    Riyad Kalla
    Member

    Milind,
    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.

    #214856 Reply

    Milind Rao
    Member

    Using the Tomcat startup files. The JAVA_OPTS variable creates System Properties for all webapps. I want System Properties for a specific webapp.

    #214866 Reply

    Paul Kaiser
    Member

    System 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

    #214926 Reply

    Milind Rao
    Member

    I 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?

    #215155 Reply

    Paul Kaiser
    Member

    I’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.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Setting System Properties per webapp [Closed]

You must be logged in to post in the forum log in