Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-917

NoSuchMethodError: o.a.l.l.core.config.Configuration.getStrSubstitutor()

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Core
    • Environment:

      Linux x86-64, JDK 1.6.x

      Description

      I have a custom RolloverStrategy that I have been using since the early betas. I am trying to bump up to v2.1 now, and when I start up my application I receive a surprising NoSuchMethodError for a method that for sure exists.

      In fact, my code is quite similar to the DefaultRolloverStrategy, and the particular call that is throwing the exception is exactly as it's used in the default scenario: config.getStrSubstitutor()

      The "SharedFileRolloverStrategy" is my class, it deals with rollovers of shared logs in a cluster with shared filesystem. Here is a bit of the debug logs during startup, including some output I've added just prior to the offending call, along with the exception:

      2014-12-08 15:24:18,164 DEBUG Calling createStrategy on class org.apache.logging.log4j.core.appender.rolling.SharedFileRolloverStrategy for element SharedFileRolloverStrategy with params(Configuration(/path/to/log4j2.xml))
      2014-12-08 15:24:18,165 DEBUG Creating SharedFileRolloverStrategy
      2014-12-08 15:32:50,086 DEBUG config = org.apache.logging.log4j.core.config.XMLConfiguration@2b54ae5a
      2014-12-08 15:32:50,087 ERROR Unable to invoke method createStrategy in class org.apache.logging.log4j.core.appender.rolling.SharedFileRolloverStrategy for element SharedFileRolloverStrategy java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:765)
      [snip for brevity]
      Caused by: java.lang.NoSuchMethodError: org.apache.logging.log4j.core.config.Configuration.getStrSubstitutor()Lorg/apache/logging/log4j/core/lookup/StrSubstitutor;
      at org.apache.logging.log4j.core.appender.rolling.SharedFileRolloverStrategy.createStrategy(SharedFileRolloverStrategy.java:74)
      ... 39 more

      I have run this under a debugger, and it is indeed an XmlConfiguration object as indicated. I see that extends AbstractConfiguration where the actual getStrSubstitutor() method is implemented. I even looked at the strings in the .class file in the JAR I downloaded and see references to that method.

      I'm at a loss as to why it is saying it does not exist.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              djohle David Johle
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: