1 Reply Latest reply on Jul 23, 2002 2:36 PM by tbfmicke

    'user' configuration properties

      I'm pretty sure this is a dumb question but I'm darned if I can find the answer...

      What's the preferred method of specifying user level properties, for instance I have a SessionBean that needs to write to a jms queue, I'd like to specify the name of this queue in the deployment descriptor, is their a section for user level stuff?

      Thanks
      Alan Shields

        • 1. Re: 'user' configuration properties
          tbfmicke

          The recommended way is to use the "env-entry" part of the ejb-jar.xml file. (Check DTD for where to put it).
          For example with the following: (taken from 1.1 EJB spec)

          <env-entry>
          <env-entry-name>foo/name1</env-entry-name>
          <env-entry-type>java.lang.String</env-entry-type>
          <env-entry-value>value1</env-entry-value>
          </env-entry>


          You can look up the value with:


          Context initCtx = new InitialContext();
          Context myEnv = (Context)initCtx.lookup("java:comp/env");

          // Get some more environment entries. These environment
          // entries are stored in subcontexts.
          String val1 = (String)myEnv.lookup(“foo/name1”);


          This is the "standard" way to do things.

          However, sometimes I have went with property files that contains the values instead. Mostly because we felt if would be simpler for users to change values using them.

          Regards