I am trying to create a plugin for the elastic apm-agent-java.
I have closely followed the external plugin example: apm-agent-java/integration-tests/external-plugin-test/external-plugin at master · elastic/apm-agent-java · GitHub
However, I am getting an exception when trying to attach the agent:
2021-10-28 08:54:14,082 [main] INFO co.elastic.apm.agent.bci.ElasticApmAgent -
Loading plugin apm-test-plugin-1.0.0-SNAPSHOT.jar
[elastic-apm-agent] ERROR Failed to start agent
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at co.elastic.apm.agent.premain.AgentMain.loadAndInitializeAgent(AgentMain.java:149)
at co.elastic.apm.agent.premain.AgentMain.init(AgentMain.java:94)
at co.elastic.apm.agent.premain.AgentMain.premain(AgentMain.java:50)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.NoClassDefFoundError: net/bytebuddy/matcher/ElementMatcher
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.instantiate(DependencyInjectingServiceLoader.java:128)
at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.instantiate(DependencyInjectingServiceLoader.java:118)
at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.<init>(DependencyInjectingServiceLoader.java:69)
at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.load(DependencyInjectingServiceLoader.java:89)
at co.elastic.apm.agent.bci.ElasticApmAgent.loadInstrumentations(ElasticApmAgent.java:171)
at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:163)
at co.elastic.apm.agent.bci.ElasticApmAgent.initialize(ElasticApmAgent.java:149)
... 13 more
Caused by: java.lang.ClassNotFoundException: net.bytebuddy.matcher.ElementMatcher
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 22 more
Any ideas what is going wrong?
Thank you!