Add tests for more recent Java versions
Currently, we state to only support up to Java 11 in the supported technologies page. However, we're probably supporting more recent versions. The easiest way to test this would be to add more recent Tomcat Docker containers, for example.
@felixbarny can i work on this?
sure 🙂
@felixbarny can you indicate to me how i can add more Tomcat Docker containers?
Have a look at this test: https://github.com/elastic/apm-agent-java/blob/01a5c8cebbf5b06f91e1ebbc614bab6c9d710f11/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/TomcatIT.java
Let me know if you need more pointers
@felixbarny please review my PR.
I think you may need to compile apm-agent-java with a newer version of java to support them. Otherwise, your shaded classloader will not be able to work with other classes. Here's an example from java 16:
2020-12-31 21:23:57,930 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.19.0 as api on Java 16-ea Runtime version: 16-ea+23 VM version: 16-ea+23 (Oracle Corporation) Linux 4.19.0-11-amd64
2020-12-31 21:23:57,933 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - VM Arguments: [-Duser.dir=//app, -Dconfig.resource=production.conf]
Failed to start agent
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at co.elastic.apm.agent.bci.AgentMain.init(AgentMain.java:119)
at co.elastic.apm.agent.bci.AgentMain.agentmain(AgentMain.java:69)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:535)
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 60
at co.elastic.apm.agent.shaded.asm.ClassReader.<init>(ClassReader.java:196)
at co.elastic.apm.agent.shaded.asm.ClassReader.<init>(ClassReader.java:177)
at co.elastic.apm.agent.shaded.asm.ClassReader.<init>(ClassReader.java:163)
at co.elastic.apm.agent.shaded.bytebuddy.utility.OpenedClassReader.of(OpenedClassReader.java:86)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default.parse(TypePool.java:679)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default.doDescribe(TypePool.java:665)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default$WithLazyResolution.access$001(TypePool.java:745)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default$WithLazyResolution.doResolve(TypePool.java:843)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default$WithLazyResolution$LazyResolution.isResolved(TypePool.java:872)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default$LazyTypeDescription$LazyAnnotationValue$ForTypeValue.doResolve(TypePool.java:6058)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default$LazyTypeDescription$LazyAnnotationValue.filter(TypePool.java:5995)
at co.elastic.apm.agent.shaded.bytebuddy.description.annotation.AnnotationValue$AbstractBase.filter(AnnotationValue.java:579)
at co.elastic.apm.agent.shaded.bytebuddy.description.annotation.AnnotationDescription$AnnotationInvocationHandler.of(AnnotationDescription.java:253)
at co.elastic.apm.agent.shaded.bytebuddy.pool.TypePool$Default$LazyTypeDescription$LazyAnnotationDescription$Loadable.load(TypePool.java:5964)
at co.elastic.apm.agent.bci.ElasticApmAgent.validateAdvice(ElasticApmAgent.java:481)
at co.elastic.apm.agent.bci.ElasticApmAgent.getTransformer(ElasticApmAgent.java:428)
at co.elastic.apm.agent.bci.ElasticApmAgent.applyAdvice(ElasticApmAgent.java:390)
at co.elastic.apm.agent.bci.ElasticApmAgent.initAgentBuilder(ElasticApmAgent.java:313)
at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:260)
at co.elastic.apm.agent.bci.ElasticApmAgent.initInstrumentation(ElasticApmAgent.java:164)
at co.elastic.apm.agent.bci.ElasticApmAgent.initialize(ElasticApmAgent.java:150)
... 12 more
@lucaskjaero this may already been handled through #1526 with the ASM version upgrade. Please try the latest agent snapshot and see if it works for you.
@eyalkoren Can confirm that fixes it, thanks! Is there a timeline for release? I'm not blocked but would like to set a reminder to get onto a release version when it's ready.
Thanks for the update! Version 1.20.0 was released yesterday with the new ASM version. Try it out. We don't have rigid release timeline, but you can register to get only release notifications from this repo.
We are now testing (at least weekly) with recent JDK versions: JDK 11, JDK 17, JDK 20 (LTS) and JDK 21 (Early-Access) since https://github.com/elastic/apm-agent-java/pull/3099 was merged, so we can consider this task as complete.