This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to configure java.net.URL outside of .war

 
Mark Lybarger
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 java.net.URL 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 java.net.URL resource ref values w/ tomcat/jboss-4.0.0 outside of jboss-web.xml?
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Lybarger
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
someone mentioned to me that in jboss you can use an mbean to provide custom stuff into jndi. i found an example here: http://www.huihoo.com/jboss/online_manual/3.0/ch13s26.html

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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic