2 Replies Latest reply on May 5, 2003 3:00 AM by riki1512

    global application variables ?

    riki1512 Newbie

      Hi,

      I have some env-entries defined in the ejb-jar.xml. If I'm right, i can lookup them only from the corresponding bean. Where can i define such variables to access them from other objects running in the same application without using properties files ?

        • 1. Re: global application variables ?
          Adrian Brock Master

          The env-entries are available in
          java:comp/env
          for the bean/web-app that defines them.

          Anything accessed on the same thread
          inside an ejb or web invocation also
          has access to this naming context.

          Regards,
          Adrian

          • 2. Re: global application variables ?
            riki1512 Newbie

            Ok, now it works, but in my book and nowhere else stands that the code for looking up env-entries

            Context initContext = new InitialContext ();
            initContext.lookup....

            works only in the Bean.

            Outside the Bean i've got to use the

            InitialContext(env)...

            constructor with the naming-service definitions to lookup env-entries, like a client calling an ejb-object.
            For you that is normal, but i as a bloody newbie am copying only that what i see.

            Why can I call the env-entry from a bean without handing over a hashtable with environment-definitions to the InitialContext ?

            Thanks