3 Replies Latest reply on Aug 13, 2002 12:07 PM by adrian.brock

    Change JNDI variable value

    jocsch

      Hi there,
      I wonder if there is a possibility to change a JNDI Integer value with the help of an admnistration tool, e.g. setting DEBUGLevel from 0 to 5 without changing the env-entry in the ejb-jar.xml and redeploying the bean.

      Anybody how knows anything about that?

      Thx,
      Markus

        • 1. Re: Change JNDI variable value

          Not currently. It could probably be added as a
          Managed Operation to org.jboss.ejb.Container

          Regards,
          Adrian

          • 2. Re: Change JNDI variable value
            cepage

            Sure, this code sets a JNDI Value:

            public void addEntry(String jndiName, String entry)
            {
            try
            {
            InitialContext jndiContext = new InitialContext();
            Util.bind( jndiContext, jndiName, entry );
            }
            catch ( NamingException namEx )
            {
            logger.error( "Exception caught in addEntry", namEx );
            }
            }

            Make this code an exposed MBean method, and you're done.

            Corby

            • 3. Re: Change JNDI variable value

              Well actually that won't work for env entries.
              They are classloader based.
              You have to temporarily swap in the container's
              classloader - see invoke()

              You probably also want to validate it is a property, not
              an ejb-ref or a resource.

              There's some conversion required of the entry
              into the required class.

              See org.jboss.ejb.Container.setUpEnvironment()
              and org.jboss.ejb.MetaData.EnvEntryMetaData()

              Regards,
              Adrian