Im Developing an Application, and I wanted to create or deploy a properties file to Websphere. I just dont want to do it manually. Is there an option to deploy it aumatically, once i deployed my EAR file to WAS 7.0 the properties file will be deployed too?..
Thanks!
If your properties file is to be editable it should not be deployed as part of your EAR file. Instead keep it somewhere on disk where the server can read it. When running on a cluster this will have to a shared disk unless you’re prepared to edit multiple local copies of properties files.
You don’t want to hard code the file path to the external properties file into your deployed EAR so you can get around this by configuring a URL resource on your Websphere server. In the Websphere 7 Admin Console access it as follows
Here are some example settings for a URL resource on a *nix box where the root of the server has a file mount named “propertiesFiles” that is visible to all server nodes in the cluster (i.e. shared network disk)
Copy your properties file into this location so you have this file path
Your Web Application can then reference this URL resource using a JDNI lookup using “url/propertiesFiles” to find the directory where your properties files are located. Therefore you haven’t hardcoded the file location into your EAR ony the name of the file (i.e. “example.properites”)
Following on from this confguration its then up to your deployment process to update the properties file independantly of your EAR deployment