AFAIK, that can be achieved in TC 4.x series, coz the ClassLoader loads the files, and you need not start the server. In 3.x series, if you change your properties files and your files load from the properties files, then you shall have to restart the server.
 

Regards,
Vikramjit Singh,
GTL Ltd.
Ph. 7612929-1059

-----Original Message-----
From: randie ursal [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 27, 2002 6:30 PM
To: [EMAIL PROTECTED]
Subject: reading a property file

hello,
 
   i have a situation here:

  
i want that i can change my property file dynamically without
   restarting Tomcat.

   i tried implementing it using the suggestion that was given to me by
   some of the people here which is to place the property file on the
   WEB-INF/classes directory and read it using this statement:

      Properties oProp = new Properties();
      oProp.load(this.getClass().getResourceAsStream
                         ("/CommandServer.properties")';
    this works fine. but the problem is when i change the property
    file dynamically while tomcat is running my changes doesn't take
    effect. the same default value was read.

    so, what i did was i make use of the File class to read the property
    file and implement it like this:

         File ofile = File ("..\\webapps\\myapp\\WEB-INF\\classes\\
                                com\\test\\MyProperty.properties");
         FileInputStream oIn = new FileInputStream(oFile);
         Properties oProp = new Properties();
         oProp.load(oIn);

    this also works, and i am able to change my property file dynamically.

    my question is, how do i place my property file so that when i read
    it using File class i don't have to include the
    "..\\webapps\\myapp\\WEB-INF\\classes" extra path...instead just read
    it directory from my package directory structure.

    is there a way Tomcat can read my property file that way?

 thanks in advance
   randie

Reply via email to