Posted By:
Anuj_Batra
Posted On:
Sunday, October 16, 2011 03:57 AM
Hi All, I have a requirement that on tomcat server startup i want to read an XML file that takes my application configuration and assign those values to the respective classes. Eg. DatabaseConfiguration (Class having static methods): Has values like username and password for DB. WebsiteConfiguration (Class having static methods): Has some configurations related to website. Initialization (Context class): Loads on tomcat startup. Reads XML and sets values in above classes via static methods. Everything goes fine on startup values get initialized. But when i try to get the values from configuration file in servle
More>>
Hi All,
I have a requirement that on tomcat server startup i want to read an XML file that takes my application configuration and assign those values to the respective classes.
Eg.
DatabaseConfiguration (Class having static methods): Has values like username and password for DB.
WebsiteConfiguration (Class having static methods): Has some configurations related to website.
Initialization (Context class): Loads on tomcat startup. Reads XML and sets values in above classes via static methods.
Everything goes fine on startup values get initialized.
But when i try to get the values from configuration file in servlet or jsp. i get a null value. Probably the lifetime of Classes expires.
How do i make the class to persist those values as long as my server is started ?
<<Less