• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

JNDI Application Resources

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application that will run on multiple server instances, DEV, TEST and eventually PROD. All of my resource properties and application switches are defined in .properties files, but are read from the file system using rather than ResourceBundles. This allows me to change application functionality without modify and re-deploying the WEB or EJB portions of the application. The only resource I need is "The location within the filesystem where the properties are". Currently that is the only item that is in an Application.properties file and read using ResourceBundle.

Does any one have know of a way to put this one "element" in the JNDI for each server instance so it doesn't have to be kept in a ResourceBundle.?

tia,
Greg
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could see a few ways to do this. The first is the simplest, but depends on you having access to the script that starts WLS. I would add something like "-Dmy.property.dir=/usr/local/bea/properties" to the command line that starts up WLS. Then, within the class that needs to find the property files/resource bundles, do something like:



This allows you to have different directories and switch between them at startup time.

Another way would be through the WLS MBean system. This is somewhat more complex but would ultimately allow you create a custom console extension for GUI configuration and so on. The data would ultimately get stored in config.xml. The docs for JMX detail what is required to implement this.

Lastly, you can access the embedded LDAP server. However, that is a little dicey as you run the risk of really hosing something up in your security system. Additionally, as it is embedded I would not think that BEA would guarantee that it will exist in the future.

The second and third options are very likely to be overkill for what you are describing. As a general statement JNDI is mostly read-only externally and so putting random bits in there is more difficult than it should be. The LDAP server, while accessable, is a bit dangerous in my mind for what you need.
[ October 25, 2004: Message edited by: Scott Dunbar ]
 
Greg Schultz
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Scott,

I used the first and simplest form

String configDir = System.getProperty( "my.property.dir" );. But rather than place it into the startup script, since I also have access to the Weblogic Console I placed the following in the Arguements field on the Configuration.Remote Start tab for each server instance, DEV and TEST.

-Dappname.filestore.dir=/home/user/domain/server/filestore/


Greg
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic