Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring instrumentation fails with spring-boot 3 / spring 6 #1283

Open
lbuffler opened this issue Jun 20, 2023 · 1 comment
Open

Spring instrumentation fails with spring-boot 3 / spring 6 #1283

lbuffler opened this issue Jun 20, 2023 · 1 comment

Comments

@lbuffler
Copy link

Spring framework version 6 (used by Spring Boot 3) changed the servlet API, moving away from javax.servlet and started using jakarta.servlet. This causes the Kamon instrumentation to fail at startup with the following exception (Kamon version 2.6.1):

Error => org.springframework.web.servlet.DispatcherServlet with message Cannot assign jakarta.servlet.http.HttpServletRequest request to interface javax.servlet.http.HttpServletRequest. Class loader: jdk.internal.loader.ClassLoaders$AppClassLoader@293a5bf6: java.lang.IllegalStateException: Cannot assign jakarta.servlet.http.HttpServletRequest request to interface javax.servlet.http.HttpServletRequest
at kanela.agent.libs.net.bytebuddy.asm.Advice$OffsetMapping$ForArgument.resolve(Advice.java:1581)
at kanela.agent.libs.net.bytebuddy.asm.Advice$OffsetMapping$ForArgument$Unresolved.resolve(Advice.java:1689)
at kanela.agent.libs.net.bytebuddy.asm.Advice$Dispatcher$Inlining$Resolved$ForMethodEnter.doApply(Advice.java:8684)
at kanela.agent.libs.net.bytebuddy.asm.Advice$Dispatcher$Inlining$Resolved$ForMethodEnter.apply(Advice.java:8642)
at kanela.agent.libs.net.bytebuddy.asm.Advice$Dispatcher$Inlining$Resolved$AdviceMethodInliner.visitMethod(Advice.java:8332)

This would be trivial to fix (just change the package name), but then it would break existing apps. Maybe there's a way to detect which version of the servlet API is installed and configure the instrumentation accordingly?

@hughsimpson
Copy link
Contributor

Yes we can do this, the instrumentation advice to configure with a new package name can just be added alongside. I don't think there's anything that makes this a hard problem given that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants