NoClassDefFoundError starting with Java agent version 1.23

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:

public class Server implements CommandLineRunner {
    public static void main(final String... args) {
        ElasticApmAttacher.attach();, 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 bootRun while on AWS the application is actually deployed as a AWS Fargate task.

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 resp.

Any help/ directions would be appreciated.

Provide logs and/or server output:

java.lang.NoClassDefFoundError: org/apache/http/HttpRequest
        at co.elastic.apm.agent.httpclient.helper.RequestHeaderAccessor.getFirstHeader(
        at co.elastic.apm.agent.impl.transaction.TraceContext.containsTraceContextTextHeaders(
        at co.elastic.apm.agent.httpclient.ApacheHttpClientInstrumentation$ApacheHttpClientAdvice.onBeforeExecute(
        at org.apache.http.impl.execchain.MainClientExec.execute(
        at org.apache.http.impl.execchain.ProtocolExec.execute(
        at org.apache.http.impl.client.InternalHttpClient.doExecute(
        at org.apache.http.impl.client.CloseableHttpClient.execute(
        at org.apache.http.impl.client.CloseableHttpClient.execute(

Hi and welcome to our forum!

It may be related to an issue fixed by
In order to test that, please try our latest build from master.

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.

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?

We don't have a rigid timeline for releases, but you can register on our repo 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).

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