# Java Agent 1.23 with AdoptOpenJDK 11 leads to NoClassDefFoundError in javax/servlet/ServletContext

**URL:** <https://discuss.elastic.co/t/java-agent-1-23-with-adoptopenjdk-11-leads-to-noclassdeffounderror-in-javax-servlet-servletcontext/274216>\
**Category:** APM\
**Tags:** docker, java\
**Created:** [May 27, 2021, 2:08pm UTC](https://discuss.elastic.co/t/java-agent-1-23-with-adoptopenjdk-11-leads-to-noclassdeffounderror-in-javax-servlet-servletcontext/274216 "2021-05-27T14:08:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_C](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_c/32/58670_2.png) [@Michael\_C](https://discuss.elastic.co/u/Michael_C)\
**Post date:** [May 27, 2021, 2:08pm UTC](https://discuss.elastic.co/t/java-agent-1-23-with-adoptopenjdk-11-leads-to-noclassdeffounderror-in-javax-servlet-servletcontext/274216/1 "2021-05-27T14:08:56Z")

</div>

**Kibana version** : 7.13  
**Elasticsearch version** : 7.13  
**APM Server version** : 7.13  
**APM Agent language and version** : java 1.23

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
When using the latest version of the javaagent I see warnings and errors upon usage.  
When using agent 1.22 or lower, no issue (except the startup warnings. But even those are gone in 1.16.)

**On startup:**

```auto
WARNING: -Xverify:none and -noverify are not supported by the Elastic APM Java Agent. In an upcoming version, the agent will not start when these flags are set, unless the system property elastic.apm.disable_bootstrap_checks is set to true.
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-05-27 09:59:52,011 [main] INFO co.elastic.apm.agent.util.JmxUtils - Found JVM-specific OperatingSystemMXBean interface: com.sun.management.OperatingSystemMXBean
2021-05-27 09:59:52,041 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.23.0 as xyz on Java 11.0.9.1 Runtime version: 11.0.9.1+1 VM version: 11.0.9.1+1 (AdoptOpenJDK) Windows 10 10.0

```

**Then on app usage:**

```auto
java.lang.NoClassDefFoundError: javax/servlet/ServletContext
	at co.elastic.apm.agent.servlet.helper.ServletTransactionCreationHelper.getClassloader(ServletTransactionCreationHelper.java:92)
	at co.elastic.apm.agent.servlet.ServletApiAdvice.onEnterServletService(ServletApiAdvice.java:104)

```

**Related Configs**  
disable\_bootstrap\_checks=true

---

<div class="post-metadata">

**Author:** ![Michael\_C](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_c/32/58670_2.png) [@Michael\_C](https://discuss.elastic.co/u/Michael_C)\
**Post date:** [May 28, 2021, 6:36pm UTC](https://discuss.elastic.co/t/java-agent-1-23-with-adoptopenjdk-11-leads-to-noclassdeffounderror-in-javax-servlet-servletcontext/274216/2 "2021-05-28T18:36:58Z")

</div>

Update! The latest snapshot resolves it, though I still get the newer warnings on initial startup.

```auto
WARNING: -Xverify:none and -noverify are not supported by the Elastic APM Java Agent. In an upcoming version, the agent will not start when these flags are set, unless the system property elastic.apm.disable_bootstrap_checks is set to true.
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.

```

The snapshot jar was fetched from here: [https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=co.elastic.apm&a=elastic-apm-agent&v=LATEST](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=co.elastic.apm&a=elastic-apm-agent&v=LATEST)

---

<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:** [May 31, 2021, 6:54am UTC](https://discuss.elastic.co/t/java-agent-1-23-with-adoptopenjdk-11-leads-to-noclassdeffounderror-in-javax-servlet-servletcontext/274216/3 "2021-05-31T06:54:56Z")

</div>

@Michael_C right, this was already fixed. 1.24.0 should be released very soon, so look for that.  
The `-Xverify:none` warning means that you can currently use the agent without a problem. However, in future release, it may stop working **by default** , so you will be able to disable the related check.

In any case, note that such instructions are very unsafe - when you get `VerifyError`s, you should try and fix them, not silence them. They mean that the verifyer thinks your bytecode is not right. In some cases, the JVM can work with such bytecode errors unnoticed, but when the agent injects bytecode into them, these problems become visible. That is why we prefer to default to abort.

---

<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:** [June 21, 2021, 2:55am UTC](https://discuss.elastic.co/t/java-agent-1-23-with-adoptopenjdk-11-leads-to-noclassdeffounderror-in-javax-servlet-servletcontext/274216/4 "2021-06-21T02:55:29Z")

</div>

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