# Instrumentation failure with Java Agent 1.56

**URL:** <https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319>\
**Category:** APM\
**Tags:** elastic-stack-monitoring, java\
**Created:** [June 25, 2026, 2:13pm UTC](https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319 "2026-06-25T14:13:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorlovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igorlovich/32/126861_2.png) [@igorlovich](https://discuss.elastic.co/u/igorlovich)\
**Post date:** [June 25, 2026, 2:13pm UTC](https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319/1 "2026-06-25T14:13:00Z")

</div>

Hello,

After upgrading to Java Agent 1.56 Instrumentation stopped working. It works fine with 1.55.6.

Java version: 26.0.1+8-FR ([Amazon.com](http://Amazon.com) Inc.) Linux 6.12.88-119.157.amzn2023.x86\_64

Tomcat version: 10.1.55

Linux: Alpine 3.24

On startup every we get a stack trace for every instrumentation ( 4k lines of stack traces)

```auto
[main] WARN co.elastic.apm.agent.bci.bytebuddy.InstallationListenerImpl - Byte Buddy warmup ended without transforming at least one class. The agent may not work as expected.
2026-06-25 15:44:38.4702026-06-25 13:44:38,469 [main] ERROR co.elastic.apm.agent.bci.ElasticApmAgent - Exception occurred while applying instrumentation co.elastic.apm.agent.java_ldap.LdapClientInstrumentation
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.IndyBootstrap.getIndyBootstrapMethod(IndyBootstrap.java:234) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.IndyBootstrap.initIndyBootstrap(IndyBootstrap.java:268) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.IndyBootstrap.loadClassInBootstrap(IndyBootstrap.java:310) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at net.bytebuddy.dynamic.loading.ClassInjector$AbstractBase.injectRaw(ClassInjector.java:202) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe.injectRaw(ClassInjector.java:1907) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$Unavailable.initialize(ClassInjector.java:2206) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.premain.AgentMain.premain(AgentMain.java:47) [elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.premain.AgentMain.init(AgentMain.java:98) [elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.premain.AgentMain.loadAndInitializeAgent(AgentMain.java:157) [elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.ElasticApmAgent.initialize(ElasticApmAgent.java:165) [elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:179) [elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:290) [elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.ElasticApmAgent.initAgentBuilder(ElasticApmAgent.java:365) [elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.ElasticApmAgent.applyAdvice(ElasticApmAgent.java:444) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.ElasticApmAgent.getTransformer(ElasticApmAgent.java:486) ~[elastic-apm-agent.jar:1.56.0]
2026-06-25 15:44:38.470	at co.elastic.apm.agent.bci.IndyBootstrap.getIndyBootstrapMethod(IndyBootstrap.java:240) ~[elastic-apm-agent.jar:1.56.0]

```

Thank you

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [June 25, 2026, 2:43pm UTC](https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319/2 "2026-06-25T14:43:04Z")

</div>

Thanks for reporting this, I will attempt to reproduce it on our end.

Can you help me clarify the following details:

- how does the java agent is attached to the tomcat server, is that through `-javaagent` JVM command line argument.
- it should happen very quickly at startup, can you confirm this ?
- does it happen even when no webapp is deployed on the tomcat server ? If yes, then it means it should be easier for us to reproduce.
- is it limited to a few instrumentations or do you see it on all of them ?
- do you have other environments where this issue is not being triggered, for example with different JVM versions

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [June 25, 2026, 3:13pm UTC](https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319/3 "2026-06-25T15:13:24Z")

</div>

Using the following configuration I did not manage to reproduce it on my side yet:

- tomcat 10.1.20
- JDK 26.0.1
- apm agent version 1.56.1-SNAPSHOT (should be identical to the 1.56.0 release)

Apart from the noisy messages, is there any impact on the application or behavior of the agent to capture traces ?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [June 25, 2026, 3:25pm UTC](https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319/4 "2026-06-25T15:25:55Z")

</div>

Well, I was too fast to conclude on my previous message.

I managed to reproduce it with JDK 26, we get error messages like the following:

```auto
2026-06-25 17:22:20,878 [main] ERROR co.elastic.apm.agent.bci.ElasticApmAgent - Exception occurred while applying instrumentation co.elastic.apm.agent.java_ldap.LdapClientInstrumentation
java.lang.RuntimeException: java.lang.UnsupportedOperationException: Could not access Unsafe class: As of Java 26, using Unsafe is disabled by default, set net.bytebuddy.safe to true if you want to use the JVM's internal unsafe API even though it will become unsupported in the future and should be replaced by injection using method handles: net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup
        at co.elastic.apm.agent.bci.IndyBootstrap.getIndyBootstrapMethod(IndyBootstrap.java:240) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.ElasticApmAgent.getTransformer(ElasticApmAgent.java:486) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.ElasticApmAgent.applyAdvice(ElasticApmAgent.java:444) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.ElasticApmAgent.initAgentBuilder(ElasticApmAgent.java:365) [elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:290) [elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:179) [elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.ElasticApmAgent.initialize(ElasticApmAgent.java:165) [elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:565) ~[?:?]
        at co.elastic.apm.agent.premain.AgentMain.loadAndInitializeAgent(AgentMain.java:157) [elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.premain.AgentMain.init(AgentMain.java:98) [elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.premain.AgentMain.premain(AgentMain.java:47) [elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:565) ~[?:?]
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:544) [?:?]
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:556) [?:?]
Caused by: java.lang.UnsupportedOperationException: Could not access Unsafe class: As of Java 26, using Unsafe is disabled by default, set net.bytebuddy.safe to true if you want to use the JVM's internal unsafe API even though it will become unsupported in the future and should be replaced by injection using method handles: net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup
        at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$Unavailable.initialize(ClassInjector.java:2206) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe.injectRaw(ClassInjector.java:1907) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at net.bytebuddy.dynamic.loading.ClassInjector$AbstractBase.injectRaw(ClassInjector.java:202) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.IndyBootstrap.loadClassInBootstrap(IndyBootstrap.java:310) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.IndyBootstrap.initIndyBootstrap(IndyBootstrap.java:268) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        at co.elastic.apm.agent.bci.IndyBootstrap.getIndyBootstrapMethod(IndyBootstrap.java:234) ~[elastic-apm-agent-1.56.1-SNAPSHOT.jar:1.56.1-SNAPSHOT]
        ... 15 more

```

You should be able to use `-Dnet.bytebuddy.safe=false` in your JVM CLI as a temporary work-around for this.

---

<div class="post-metadata">

**Author:** ![igorlovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igorlovich/32/126861_2.png) [@igorlovich](https://discuss.elastic.co/u/igorlovich)\
**Post date:** [June 26, 2026, 9:30am UTC](https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319/5 "2026-06-26T09:30:21Z")

</div>

Hello,

Can you help me clarify the following details:

- how does the java agent is attached to the tomcat server, is that through `-javaagent` JVM command line argument.

yes

- it should happen very quickly at startup, can you confirm this ?

yes

- does it happen even when no webapp is deployed on the tomcat server ? If yes, then it means it should be easier for us to reproduce.

hard to test as we deploy the docker container with the app already deployed.

- is it limited to a few instrumentations or do you see it on all of them ?

all of them.

- do you have other environments where this issue is not being triggered, for example with different JVM versions

Works fine with java-25 / tomcat

- Apart from the noisy messages, is there any impact on the application or behavior of the agent to capture traces ?

Yes..no traces are sent/present to the stack. No trace id / transaction ids are present in the logs. There is still jvm related information being sent (heap, threads etc..)

- `-Dnet.bytebuddy.safe=false`

This fixes the problem.

Thank you

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [June 26, 2026, 12:26pm UTC](https://discuss.elastic.co/t/instrumentation-failure-with-java-agent-1-56/387319/6 "2026-06-26T12:26:03Z")

</div>

I've opened an issue so we can investigate further: [UnsupportedOperationException at startup when using JDK 26+ · Issue #4519 · elastic/apm-agent-java · GitHub](https://github.com/elastic/apm-agent-java/issues/4519)

You can subscribe to it so you'll get notified when it's fixed or when a snapshot might be available for testing.
