apm-agent-java: log4j using by the agent will attempt to loading the application's log4j2 class, leads to ClassNotFoundException
the log here
ERROR StatusLogger Unable to create custom ContextSelector. Falling back to default.
java.lang.ClassNotFoundException: org/apache/logging/log4j/core/async/AsyncLoggerContextSelector
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at co.elastic.apm.agent.shaded.apache.logging.log4j.util.LoaderUtil.loadClass(LoaderUtil.java:168)
at co.elastic.apm.agent.shaded.apache.logging.log4j.util.LoaderUtil.newInstanceOf(LoaderUtil.java:207)
at co.elastic.apm.agent.shaded.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:228)
at co.elastic.apm.agent.shaded.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOfProperty(LoaderUtil.java:253)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.util.Loader.newCheckedInstanceOfProperty(Loader.java:338)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.impl.Log4jContextFactory.createContextSelector(Log4jContextFactory.java:98)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:59)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at co.elastic.apm.agent.shaded.apache.logging.log4j.LogManager.<clinit>(LogManager.java:94)
at co.elastic.apm.agent.shaded.apache.logging.log4j.spi.ThreadContextMapFactory.createThreadContextMap(ThreadContextMapFactory.java:99)
at co.elastic.apm.agent.shaded.apache.logging.log4j.ThreadContext.init(ThreadContext.java:225)
at co.elastic.apm.agent.shaded.apache.logging.log4j.ThreadContext.<clinit>(ThreadContext.java:203)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createDefaultInjector(ContextDataInjectorFactory.java:83)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createInjector(ContextDataInjectorFactory.java:67)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.lookup.ContextMapLookup.<init>(ContextMapLookup.java:34)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:120)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:87)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.config.ConfigurationFactory.<init>(ConfigurationFactory.java:133)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.config.ConfigurationFactory$Factory.<init>(ConfigurationFactory.java:354)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.config.ConfigurationFactory$Factory.<init>(ConfigurationFactory.java:354)
at co.elastic.apm.agent.shaded.apache.logging.log4j.core.config.ConfigurationFactory.<clinit>(ConfigurationFactory.java:131)
at co.elastic.apm.agent.logging.LoggingConfiguration.init(LoggingConfiguration.java:198)
at co.elastic.apm.agent.impl.ElasticApmTracerBuilder.<init>(ElasticApmTracerBuilder.java:92)
at co.elastic.apm.agent.bci.ElasticApmAgent.initialize(ElasticApmAgent.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at co.elastic.apm.agent.bci.AgentMain.init(AgentMain.java:100)
at co.elastic.apm.agent.bci.AgentMain.premain(AgentMain.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (18 by maintainers)
the agent not working, No Class has been retransformed. the agent was built from master branch, lastest comit is
518afc790674f311b00fb188fe2444b1a6a81a6a
@eyalkoren The error logs has gone, and the agent work well.