# NoClassDefFoundError starting with Java agent version 1.23

**URL:** <https://discuss.elastic.co/t/noclassdeffounderror-starting-with-java-agent-version-1-23/271573>\
**Category:** APM\
**Tags:** java\
**Created:** [April 29, 2021, 12:39am UTC](https://discuss.elastic.co/t/noclassdeffounderror-starting-with-java-agent-version-1-23/271573 "2021-04-29T00:39:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoergHeinicke5005](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joergheinicke5005/32/87893_2.png) [@JoergHeinicke5005](https://discuss.elastic.co/u/JoergHeinicke5005)\
**Post date:** [April 29, 2021, 12:39am UTC](https://discuss.elastic.co/t/noclassdeffounderror-starting-with-java-agent-version-1-23/271573/1 "2021-04-29T00:39:44Z")

</div>

**APM Agent language and version** : Java Agent v1.23

\*\*Description of the problem including expected versus actual behavior. \*\*:  
We have a Spring Boot application in which we attach the Java APM Agent programmatically:

```auto
@SpringBootApplication
public class Server implements CommandLineRunner {
    public static void main(final String... args) {
        ElasticApmAttacher.attach();
        SpringApplication.run(Server.class, args);
    }
}

```

This application accesses AWS services' Rest APIs via the AWS Java SDK.

The application is built using Gradle and can be executed locally (on developer's machine) using `./gradlew -Dspring.profiles.active=local bootRun` while on AWS the application is actually deployed as a AWS Fargate task.

```auto
dependencies {
    ...
    implementation "co.elastic.apm:apm-agent-attach:1.23.0"
    ...
}

```

While everything seems to work in the cloud environments we are facing following `NoClassDefFoundError` for `org/apache/http/HttpRequest` starting with agent version 1.23 in local environment while with 1.22 these entries are not appearing.

The class is actually available on the application's runtime classpath (according to `./gradlew htmlDependencyReport`) in `org.apache.httpcomponents:httpcore:4.4.14` resp. `httpcore-4.4.14.jar` as transitive dependency of `software.amazon.awssdk:apache-client:2.16.44` resp. `software.amazon.awssdk:sns:2.16.44`.

Any help/ directions would be appreciated.

**Provide logs and/or server output** :

```auto
java.lang.NoClassDefFoundError: org/apache/http/HttpRequest
        at co.elastic.apm.agent.httpclient.helper.RequestHeaderAccessor.getFirstHeader(RequestHeaderAccessor.java:34)
        at co.elastic.apm.agent.impl.transaction.TraceContext.containsTraceContextTextHeaders(TraceContext.java:195)
        at co.elastic.apm.agent.httpclient.ApacheHttpClientInstrumentation$ApacheHttpClientAdvice.onBeforeExecute(ApacheHttpClientInstrumentation.java:71)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:155)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
        at software.amazon.awssdk.http.apache.internal.impl.ApacheSdkHttpClient.execute(ApacheSdkHttpClient.java:72)

```

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [April 29, 2021, 3:38am UTC](https://discuss.elastic.co/t/noclassdeffounderror-starting-with-java-agent-version-1-23/271573/2 "2021-04-29T03:38:59Z")

</div>

Hi and welcome to our forum!

It may be related to an issue fixed by [https://github.com/elastic/apm-agent-java/pull/1785](https://github.com/elastic/apm-agent-java/pull/1785).  
In order to test that, please try our [latest build from master](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-java%2Fapm-agent-java-mbp/detail/master/883/artifacts).

If this doesn't solve the issue, please set `log_level` to `debug` and provide a full agent log from startup and including the full stack trace.

---

<div class="post-metadata">

**Author:** ![JoergHeinicke5005](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joergheinicke5005/32/87893_2.png) [@JoergHeinicke5005](https://discuss.elastic.co/u/JoergHeinicke5005)\
**Post date:** [April 29, 2021, 9:52am UTC](https://discuss.elastic.co/t/noclassdeffounderror-starting-with-java-agent-version-1-23/271573/3 "2021-04-29T09:52:48Z")

</div>

Hi Eyal,

It seems the fix does fix the issue - at least it doesn't occur with the snapshot anymore.

Thanks a lot! Is there already a timeline for releasing 1.23.1?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [April 29, 2021, 10:36am UTC](https://discuss.elastic.co/t/noclassdeffounderror-starting-with-java-agent-version-1-23/271573/4 "2021-04-29T10:36:11Z")

</div>

Awesome!  
We don't have a rigid timeline for releases, but you can register on our [repo](https://github.com/elastic/apm-agent-java) to receive notifications about releases.  
In the mean time, you can either use 1.22.0, or keep using this snapshot (note that we also release from master so it should be OK in terms of stability).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 20, 2021, 6:37am UTC](https://discuss.elastic.co/t/noclassdeffounderror-starting-with-java-agent-version-1-23/271573/5 "2021-05-20T06:37:05Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
