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)
[snip for brevity]
Caused by: java.lang.NoSuchMethodError: org.apache.logging.log4j.core.config.Configuration.getStrSubstitutor()Lorg/apache/logging/log4j/core/lookup/StrSubstitutor;
... 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.