4 Replies Latest reply on Jan 24, 2013 5:59 AM by dach

    JBoss 7.1.1 web.xml context-param and env-entry override at deployment time

    dach Newbie

      I have an application that makes use of several context params and env entries defined inside the web.xml descriptor.

      At deployment time I'd like to override the default values with those required by the environment I'm deploying to (i.e. development, test, production).

      Given that I do not like having to produce a different EAR or WAR package for each environment, what is the right way to do this?


      So far I've been able to set only the env entries through the following CLI command:



      However this solution has the following drawbacks:

      - The JNDI names are visible to every web application deployed on the same server, instead I'd rather be scoped only within the single web application to which they belong.

      - I've been forced to completely remove the default env entries definitions from the web.xml

      - I'd like to keep my application compatibility to different application server platforms, so a standard naming syntax (supported even by java 1.4/servlet 2.3) would be ideal. The following code snippet is the way I was using to lookup my env entries:


              Context ic = new InitialContext();

              String myVariable = (String) ic.lookup("java:comp/env/myVariable");