This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes [Urgent]Accessing properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "[Urgent]Accessing properties file " Watch "[Urgent]Accessing properties file " New topic
Author

[Urgent]Accessing properties file

Sukh sri
Greenhorn

Joined: Mar 25, 2008
Posts: 3
We have a requirment where we need to access the properties file from various J2EE modules like war , rar , ejb-jar . These modules can modify the properies file. And the modification should be availbale to other modules ....

What will be the good option.
Sukh sri
Greenhorn

Joined: Mar 25, 2008
Posts: 3
Why there were no replies .... is there something missing from the details...

... we came through different approaches like

Using properties file , resource bundle etc .. but , our requirement is that the properties file should be writable
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
I'm sorry, but you have to be kidding to expect an answer in 30 minutes: PatienceIsAVirtue. You might also usefully read EaseUp and the other tips we have on getting the most out of the Saloon: HowToAskQuestionsOnJavaRanch.


Ping & DNS - updated with new look and Ping home screen widget
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
An updated properties file is usually available after the application has been redeployed or the server restarted. Consider writing to a database instead.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Sukh sri
Greenhorn

Joined: Mar 25, 2008
Posts: 3
Hi Roger ,

thanks for your reply . But , the information that will go into the property file is about "ports" which does not look good to put them in the database. And also , this config file is to be shared between rar and war files .
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
I don't see why port data cannot be written to a DB.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9315
    
109

Originally posted by Sukh sri:
But , the information that will go into the property file is about "ports" which does not look good to put them in the database.


In addition to what Roger mentioned, property files are in most cases changed during deployment and not dynamically. I second with what Roger mentioned about using database for storing/sharing this information. However, if you are still reluctant in doing this, you can think of having a single common service which will be used by these war,rar etc... to modify/access the properties. Doing this will ensure that the common service is aware of any changes to the properties and will be able to return this changed property.


[My Blog] [JavaRanch Journal]
 
 
subject: [Urgent]Accessing properties file
 
Similar Threads
What is the best practice to add the application property files to the classpath?
using log4j appenders from jakarta commons logging
Multiple properties files
Problem redploying an existing ear
Putting properties files in the root of the .ear?