6 Replies Latest reply on Oct 2, 2003 1:28 AM by Bernd Zeitler

    env-entry configuration

    kentcb Newbie

      Hi all,

      I am using build 3.2.1 of JBoss. One of my session EJBs needs to connect to a JMS service. Hence, it needs JNDI information about the JMS service. The way I accomplished this was to store the JNDI information in env-entries for the session EJB:


      <ejb-name>PublishingServices</ejb-name>
      <!-- snip -->
      <env-entry>

      <env-entry-name>jndi_jms_topic_connection</env-entry-name>
      <env-entry-type>java.lang.String</env-entry-type>
      <env-entry-value>jms/eSMConnectionFactory</env-entry-value>
      </env-entry>
      <!-- snip -->

      Obviously this information may differ between environments. The whole point of environment entries is to allow for changes between environments. So how does JBoss allow these entries to be altered after deployment? I thought the JMX console would allow this but it doesn't appear to . . .

      Thanks,
      Kent

        • 1. Re: env-entry configuration
          Juha Lindfors Master

          You can't.

          -- Juha

          • 2. Re: env-entry configuration
            kentcb Newbie

            OK; any chance you could ellaborate on that? Why can't this be done? Are there plans to implement this soon? How do others work around this problem?

            Thanks,
            Kent

            • 3. Re: env-entry configuration
              Juha Lindfors Master

              It can't be done because the EJB spec disallows any modifications to the env-entries from the EJB; you can only read them.

              If you need modifiable entries in the JNDI you can bind them into the public JNDI context, javax.naming.Context.bind()

              -- Juha

              • 4. Re: env-entry configuration
                kentcb Newbie

                Sorry, there must be a misunderstanding here somewhere. I don't want my EJBs to modify the environment entry. They simply read and use the value of the env-entry. I want the deployer of my application to be able to modify these entries to suit the particular environment they have deployed to.

                The EJB Spec [2.0], section 20.2.1.2 states the following:

                If the Bean Provider provides a value for an environment entry using the env-entry-value element,
                the value can be changed later by the Application Assembler or Deployer.

                That implies that there should be some mechanism via which env-entries can be modified after deployment.

                Kent

                • 5. Re: env-entry configuration
                  Juha Lindfors Master

                  No, both application assembler and deployer roles are prior to actual deployment to the app server: application assembler composes an EAR out of J2EE components and deployer sets up the resource mappings to match the current deployment environment. Once the env-entry is bound to the bean's private ENC it's read-only.

                  -- Juha

                  • 6. Re: env-entry configuration
                    Bernd Zeitler Expert

                    You probably want to map a global (or vm) namespace to a comp/env namespace for your bean, so the bean always uses the comp/env jndi name and the mapping to the real resource is done in your deployment descriptors of your bean when the bean is deployed.
                    Use the resource tags with your deployment descriptors.

                    Greetings,
                    Frito