[ 
https://issues.apache.org/jira/browse/LOG4J2-917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Johle closed LOG4J2-917.
------------------------------
    Resolution: Not a Problem

Gah!  There was a stray JAR file in my classpath that was interfering.

> NoSuchMethodError: o.a.l.l.core.config.Configuration.getStrSubstitutor()
> ------------------------------------------------------------------------
>
>                 Key: LOG4J2-917
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-917
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1
>         Environment: Linux x86-64, JDK 1.6.x
>            Reporter: David Johle
>            Priority: Minor
>              Labels: configuration, exception, startup
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to