Hi,
I am using the apm-agent-attach-cli-1.29.0.jar in order to monitor a Java application (installed openjdk version "1.8.0_292").
Log shows that the agent is not able to start:
[elastic-apm-agent] ERROR Failed to start agent
It looks like the problem is linked with bytebuddy:
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "net.bytebuddy.createJavaDispatcher")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:886)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
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 net.bytebuddy.utility.dispatcher.JavaDispatcher.run(JavaDispatcher.java:178)
at java.security.AccessController.doPrivileged(Native Method)
at net.bytebuddy.description.type.TypeDescription$ForLoadedType.doPrivileged(TypeDescription.java)
at net.bytebuddy.description.type.TypeDescription$ForLoadedType.<clinit>(TypeDescription.java:8543)
... 26 more
In the java policy file I added the complete permission for the runtime, but this doesn't fix the permission problem.
permission java.lang.RuntimePermission ".";
Someone has faced this problem?
APM Client version:
apm-agent-attach-cli-1.29.0.jar
APM Agent language and version:
Java
Log:
INFO | jvm 2 | 2022/03/07 10:27:02.837 | [elastic-apm-agent] ERROR Failed to start agent
INFO | jvm 2 | 2022/03/07 10:27:02.837 | java.lang.reflect.InvocationTargetException
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at co.elastic.apm.agent.premain.AgentMain.loadAndInitializeAgent(AgentMain.java:149)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at co.elastic.apm.agent.premain.AgentMain.init(AgentMain.java:93)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at co.elastic.apm.agent.premain.AgentMain.agentmain(AgentMain.java:60)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:411)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | Caused by: java.util.ServiceConfigurationError
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.instantiate(DependencyInjectingServiceLoader.java:150)
INFO | jvm 2 | 2022/03/07 10:27:02.837 | at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.instantiate(DependencyInjectingServiceLoader.java:118)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.<init>(DependencyInjectingServiceLoader.java:69)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.load(DependencyInjectingServiceLoader.java:89)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at co.elastic.apm.agent.bci.ElasticApmAgent.loadInstrumentations(ElasticApmAgent.java:168)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:160)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at co.elastic.apm.agent.bci.ElasticApmAgent.initialize(ElasticApmAgent.java:146)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | ... 13 more
INFO | jvm 2 | 2022/03/07 10:27:02.838 | Caused by: java.lang.reflect.InvocationTargetException
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at co.elastic.apm.agent.util.DependencyInjectingServiceLoader.instantiate(DependencyInjectingServiceLoader.java:141)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | ... 19 more
INFO | jvm 2 | 2022/03/07 10:27:02.838 | Caused by: java.lang.ExceptionInInitializerError
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at net.bytebuddy.matcher.ElementMatchers.takesArgument(ElementMatchers.java:1248)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$InitializeInstrumentation.<init>(AbstractSpanInstrumentation.java:158)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | ... 24 more
INFO | jvm 2 | 2022/03/07 10:27:02.838 | Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "net.bytebuddy.createJavaDispatcher")
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at java.security.AccessController.checkPermission(AccessController.java:886)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at net.bytebuddy.utility.dispatcher.JavaDispatcher.run(JavaDispatcher.java:178)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at java.security.AccessController.doPrivileged(Native Method)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at net.bytebuddy.description.type.TypeDescription$ForLoadedType.doPrivileged(TypeDescription.java)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | at net.bytebuddy.description.type.TypeDescription$ForLoadedType.<clinit>(TypeDescription.java:8543)
INFO | jvm 2 | 2022/03/07 10:27:02.838 | ... 26 more