my dog learned polymorphism*
The moose likes Websphere and the fly likes Best way to place property file values in Webspehere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Best way to place property file values in Webspehere" Watch "Best way to place property file values in Webspehere" New topic
Author

Best way to place property file values in Webspehere

Ravi Narula
Greenhorn

Joined: Jun 14, 2011
Posts: 6
Hi All,

What is the best way to place property file values in web sphere so that I can change them from admin console

Thanks
Ravi Narula
Greenhorn

Joined: Jun 14, 2011
Posts: 6
Anybody?

Thanks.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
I don't know of a way where you can edit the property file values directly from the WAS console.

Key points to consider are:

1. Bundle the property file(s) in the jar that uses it. Requires you to deploy new jar every time property has to change.

2. Keep the property file outside application EAR/WAR/JAR file(s) but in a location like "\WebSphere\AppServer\profiles\<profile>\config\cells\<cell name>", which WAS will copy in all the nodes within ND environment.

3. The name of the property file can be either hard-wired in the application OR picked up from a WAS variable.

4. You can change the property file under "config\cells\<cell name>" folder and WAS will sync it up with all the nodes in ND environment. In Base env you are all set anyways.
Ravi Narula
Greenhorn

Joined: Jun 14, 2011
Posts: 6
Deepak Pant wrote:I don't know of a way where you can edit the property file values directly from the WAS console.

Key points to consider are:

1. Bundle the property file(s) in the jar that uses it. Requires you to deploy new jar every time property has to change.

2. Keep the property file outside application EAR/WAR/JAR file(s) but in a location like "\WebSphere\AppServer\profiles\<profile>\config\cells\<cell name>", which WAS will copy in all the nodes within ND environment.

3. The name of the property file can be either hard-wired in the application OR picked up from a WAS variable.

4. You can change the property file under "config\cells\<cell name>" folder and WAS will sync it up with all the nodes in ND environment. In Base env you are all set anyways.


Hi Deepak,

Thanks for the reply. Is it possible for you to direct me to an example on the web for the above? Mainly placing the property file in the config\cells folder and how to read it from there? I'd really appreciate it.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
No I don't have a sample code. I have it read in IBM Redbooks and used this concept myself in WebSphere clustered ND environment. You don't have to hardcode the path in the application. You can get WAS_CONFIG_ROOT or USER_INSTALL_ROOT type system properties and then add cell name to it.
Anant Rao
Ranch Hand

Joined: Nov 12, 2004
Posts: 126
Instead of or WAS variable or hard coding the path, create a URL resource. Here is an example.

http://www.ibm.com/developerworks/websphere/library/techarticles/0502_botzum/0502_botzum.html

Thanks
Anant
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
Yes that would work as well. For ND environments copying the property file to all nodes would be required. Keeping it under config/cells makes it easier as WAS will copy it to all nodes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way to place property file values in Webspehere