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

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:

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:

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

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

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

@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 VerifyErrors, 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.

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