I have a Web Application calling 3rd party Web Services. This application needs a number of configurable parameters.
For eg: Java.util.logging parameters, Web Services URLs and other parameters. Which is the best place to store them as configurable parameters?
1. I can store them in my Web.xml and retrieve them in the Servlet, but I might have to redeploy my application everytime, one of the parameters changes.
2. I can store them in a properties file, say, ABC.properties, using a static class or a Singleton to a access the properties. But is it OK to read configurable properties in this way from a J2EE application?
3. Use a ResourceBundle?
Which is the preferred way of loading configurable parameters in a J2EE Application?
thanks,
-
Loading Configurable Parameters in a J2EE App (6 messages)
- Posted by: Vishwa Kumba
- Posted on: October 18 2004 14:03 EDT
Threaded Messages (6)
- Loading Configurable Parameters in a J2EE App by Gian G on October 19 2004 02:36 EDT
- A Simpler Solution by Vishwa Kumba on October 19 2004 08:22 EDT
-
A Simpler Solution by Arun Nair on October 19 2004 09:29 EDT
-
Simpler maintenance of the Config file by Vishwa Kumba on October 20 2004 06:38 EDT
- This might help.. by Tunde Ojomo on October 20 2004 01:02 EDT
-
Simpler maintenance of the Config file by Vishwa Kumba on October 20 2004 06:38 EDT
-
A Simpler Solution by Arun Nair on October 19 2004 09:29 EDT
- A Simpler Solution by Vishwa Kumba on October 19 2004 08:22 EDT
- Loading Configurable Parameters in a J2EE App by Artem Yegorov on October 20 2004 15:31 EDT
-
Loading Configurable Parameters in a J2EE App[ Go to top ]
- Posted by: Gian G
- Posted on: October 19 2004 02:36 EDT
- in response to Vishwa Kumba
I am using JFig:
"... JFig is a powerful yet easy-to-use configuration tool for Java applications. It allows developers to maintain more than one configuration for their applications, corresponding to different environments their application is intended to run in. JFig saves all these configurations in one common repository in a neat hierarchy, thus simplifying the location, management, and modification of different configurations. JFig also allows a developer to modify the configurations to make changes "on the fly" in the running application, thus saving time and efforts used in locating relevant configurations, making changes, stopping and restarting/redeploying the application to reflect these changes. ..."
JFig can be downloaded for free with a LGPL license from Sourceforge ( http://jfig.sourceforge.net/ ). -
A Simpler Solution[ Go to top ]
- Posted by: Vishwa Kumba
- Posted on: October 19 2004 08:22 EDT
- in response to Gian G
Thanks Gian,
We are using Weblogic 8.1. Open Source Projects are a bit difficult to get approved by my managers over here.
I am looking for a much simpler solution. I am not sure, if it would be OK for me to deploy my application in an exploded format and store my MyAppConfig.properties file in WEB-INF/Classes directory or APP-INF/lib directory.
Regards,
Vishwa -
A Simpler Solution[ Go to top ]
- Posted by: Arun Nair
- Posted on: October 19 2004 09:29 EDT
- in response to Vishwa Kumba
Why dont you have a table to store properties and have
a read only bean to get those values.
Arun -
Simpler maintenance of the Config file[ Go to top ]
- Posted by: Vishwa Kumba
- Posted on: October 20 2004 06:38 EDT
- in response to Arun Nair
Arun,
Initial loading of the parameters from a database table might be alright.I can load them once and cache them in the memory, but how do I easily change/maintain the configurable parameters, going forward? Do I use SQL/Toad to access the table, or provide another tool to do that?
Currently we have a 2-tier Java System which loads a properties file containing all the configuration parameters.
It is easy to change the values in the properties file and all we need is restart the System during non-business hours. Our Operations team are very comfortable with this. I am also planning to do the same for the new J2EE project. But I wonder what the J2EE Puritans have to say about this. I intend to load the properties file from a static method(class) once from the Servlet!...Does this violate the J2EE Philosophy?
Also, I intend to store the properties file containg all the necessary configuration parameters for my application in a directory that is in the classpath of the server and not in the ear file, as I am not keen on redeploying the application everytime, I change the values in the properties file.
thanks,
- Vishwa -
This might help..[ Go to top ]
- Posted by: Tunde Ojomo
- Posted on: October 20 2004 13:02 EDT
- in response to Vishwa Kumba
Check this page out. It might be helpful..
http://www.javaworld.com/javaworld/javatips/jw-javatip125.html -
Loading Configurable Parameters in a J2EE App[ Go to top ]
- Posted by: Artem Yegorov
- Posted on: October 20 2004 15:31 EDT
- in response to Vishwa Kumba
I would not use Web.xml for that since none of your properties seem to relate to the web app configuration, but propety files should be good as well as ResourceBundle. I think in you case ResourceBundle should work out just fine and it provides an easy mechanism to get it using relative path.
Regards,
Artem D. Yegorov
http://www.activexml.org