Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-44

[configuration] Composite configuration with JNDI logs failed access as ERROR

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: All

      Description

      This is a report from the Turbine developer list.

      Commons configuration 1.1 logs failed JNDI lookups at ERROR level. I use the
      composite configuration as follows

      <configuration>
      <jndi prefix="java:comp/env"/>
      <properties fileName="WEB-INF/conf/TurbineResources.properties"/>
      </configuration>

      This configuration is described in the configuration-howto of Turbine.
      The expected behaviour is that the entries in the JNDI context overwrite those
      in the properties file. That, in turn, means, that usually only a few
      configuration keys will exist in the JNDI context.

      In the current version of commons-configuration (1.1) this means an error entry
      in the log with every access to a not overridden configuration key (which are
      the majority).

      Could you please reduce the log level for this or return to the behaviour of
      version 1.0 not to log this at all?

        Activity

        Hide
        Emmanuel Bourg added a comment -

        Good point, missing properties in the JNDI context shouldn't be logged as
        errors, but it is desirable to log the other errors. What exception is really
        thrown by Context.lookup ? Is it a NameNotFoundException, or just a
        NamingException as documented in the javadoc ? If the implementation throws a
        NameNotFoundException we could remove the logging for this case and keep it for
        the other errors.

        Show
        Emmanuel Bourg added a comment - Good point, missing properties in the JNDI context shouldn't be logged as errors, but it is desirable to log the other errors. What exception is really thrown by Context.lookup ? Is it a NameNotFoundException, or just a NamingException as documented in the javadoc ? If the implementation throws a NameNotFoundException we could remove the logging for this case and keep it for the other errors.
        Hide
        Thomas Vandahl added a comment -

        The stacktrace is as follows:

        2005-09-15 10:08:52,015 ERROR
        [org.apache.commons.configuration.JNDIConfiguration] Name log4j is not bound in
        this Context
        javax.naming.NameNotFoundException: Name log4j is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:197)
        at
        org.apache.commons.configuration.JNDIConfiguration.containsKey(JNDIConfiguration.java:329)
        at
        org.apache.commons.configuration.CompositeConfiguration.getProperty(CompositeConfiguration.java:152)
        at
        org.apache.commons.configuration.AbstractConfiguration.resolveContainerStore(AbstractConfiguration.java:908)
        at
        org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:809)
        at org.apache.turbine.Turbine.configure(Turbine.java:322)
        [...]
        (Rest deleted)

        Show
        Thomas Vandahl added a comment - The stacktrace is as follows: 2005-09-15 10:08:52,015 ERROR [org.apache.commons.configuration.JNDIConfiguration] Name log4j is not bound in this Context javax.naming.NameNotFoundException: Name log4j is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:814) at org.apache.naming.NamingContext.lookup(NamingContext.java:197) at org.apache.commons.configuration.JNDIConfiguration.containsKey(JNDIConfiguration.java:329) at org.apache.commons.configuration.CompositeConfiguration.getProperty(CompositeConfiguration.java:152) at org.apache.commons.configuration.AbstractConfiguration.resolveContainerStore(AbstractConfiguration.java:908) at org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:809) at org.apache.turbine.Turbine.configure(Turbine.java:322) [...] (Rest deleted)
        Hide
        Emmanuel Bourg added a comment -

        I submitted a fix to not log NameNotFoundException. Let me know how it works for
        you.

        Show
        Emmanuel Bourg added a comment - I submitted a fix to not log NameNotFoundException. Let me know how it works for you.
        Hide
        Thomas Vandahl added a comment -

        Yes, it works for me.

        Show
        Thomas Vandahl added a comment - Yes, it works for me.

          People

          • Assignee:
            Unassigned
            Reporter:
            Thomas Vandahl
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development