1 Reply Latest reply on Jan 23, 2007 3:41 PM by brianr

    <Environment> entry in Tomcat's context file.

    brianr

      I'm looking into the possibility of migrating our web applications from standalone Tomcat to JBoss AS. One difference I seem to have encountered arises from an error related to the lookup of values we had defined in entries in our web application contexts... when the WAR file is deployed in JBoss, our servlets can't seem to locate those entries.

      The context files included something along the lines of:



      Then, in a servlet that is loaded upon startup of the application, we read in this variable to initialize some important information in the web application that needs to be different between our development, QA, and production environments:

      Context ctx = new InitialContext();
      Context envCtx = (Context) ctx.lookup("java:comp/env");
      String importantList = (String) envCtx.lookup("importantList");

      How is something similar to this accomplished with JBoss? In which file would the variable need to be defined? I'd prefer to keep this outside of the WAR file, if possible, as we are able to do in standalone Tomcat. Doing so greatly simplifies our process of moving from Development to QA to Production, as we're able to simply copy the WAR file to the appropriate server as it is approved at each stage of testing, without changing any of the internal settings.

        • 1. Re: Environment entry in Tomcat's context file.
          brianr

          Well, that post didn't turn out quite as I expected...

          The context file includes an entry along the lines of:

          <Environment name="importantList" value="1,2,3" type="java.lang.String />

          I had disabled HTML in my post earlier, and I guess that wasn't such a good idea, as it also removed the text from the Topic portion of this thread.