File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes how to configure outside of .war Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to configure outside of .war" Watch "how to configure outside of .war" New topic

how to configure outside of .war

Mark Lybarger
Ranch Hand

Joined: Dec 19, 2003
Posts: 72
our platform is this: jboss 4.0.0, w/ tomcat servlet container. we're not using the ejb container at all. our web apps declare and use a resource-ref in their web.xml. they use these urls for various work.

i'd like to configure the value of these urls outside of my .war/ear application, but currently the only thing i can see is to define the value in the jboss-web.xml that is packaged w/ my application.

is there a way to configure resource ref values w/ tomcat/jboss-4.0.0 outside of jboss-web.xml?
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

In my understanding it's certain J2EE web application packaging design flaw. You can't do post deploy tuning, unless you use something J2EE app container specific. If somebody knows a generic solution plese share with us. Currently I package .war using information about target system, like URL where I'm going to store user's generated resources. It would be nice to have one .war for any system, when a user can do post tuning just using web UI provided by my app.

Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Mark Lybarger
Ranch Hand

Joined: Dec 19, 2003
Posts: 72
someone mentioned to me that in jboss you can use an mbean to provide custom stuff into jndi. i found an example here:

it really seems to me to be more a hack than a solution. this type of thing is something you expect the container to provide. providing runtime configuration for an application outside of the app itself. clearly the j2ee specification is lacking in this respect.

i'd imagine that env-entries are essentially the same in jboss (though we're not using them yet) in that they're defined in jboss-web.xml right along with the war. what if you want a test deployment to have env-entry of 10% discount, and prod to have 12.5% discount?

i've also read that w/ tomcat you can provide your own resource manager to provide stuff into jndi, but haven't seen an example yet on that.

i think a workable solution may be to have a mbean that reads from an xml configuration file stuff to put into jndi, then based on a parameter will choose from a group of potential values to use. the xml file can have DEV, TEST1, TESTT2, PROD groupings of values.

-- off to do some coding..
I agree. Here's the link:
subject: how to configure outside of .war
It's not a secret anymore!