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

Incompatibility with Spring Boot 3.0.0 #4323

Closed
andres-loyola opened this issue Nov 26, 2022 · 10 comments
Closed

Incompatibility with Spring Boot 3.0.0 #4323

andres-loyola opened this issue Nov 26, 2022 · 10 comments

Comments

@andres-loyola
Copy link

andres-loyola commented Nov 26, 2022

I have a Kotlin project with Spring Boot 3.0.0

I added the tracer in the Dockerfile :

FROM openjdk:17 ADD https://dtdg.co/latest-java-tracer /opt/dd-java-agent.jar

The container is built correctly but when I run it I got this error:

Caused by: java.lang.IllegalStateException: Failed to introspect Class [datadog.trace.instrumentation.springweb.OrderedServletPathRequestFilter] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@66434cc8] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483) at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:320) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.checkLookupMethods(AutowiredAnnotationBeanPostProcessor.java:448) ... 62 common frames omitted Caused by: java.lang.NoClassDefFoundError: javax/servlet/FilterConfig at java.base/java.lang.Class.getDeclaredMethods0(Native Method) at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402) at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504) at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465) ... 64 common frames omitted Caused by: java.lang.ClassNotFoundException: javax.servlet.FilterConfig at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 68 common frames omitted

I think it's because Spring Boot 3.0.0 is now using Jakarta instead of javax:

java.lang.ClassNotFoundException: javax.servlet.FilterConfig

When I removed the datadog tracer, it runs normally.

Version used: 1.1.3~327e6fb644

@mcculls
Copy link
Contributor

mcculls commented Nov 27, 2022

Hi @andres-loyola thanks for reporting this - this exception shouldn't happen with 1.0.1, so you could downgrade to that version as a workaround.

@andres-loyola
Copy link
Author

it works! thank you

@mcculls
Copy link
Contributor

mcculls commented Nov 30, 2022

Hi @andres-loyola we've released 1.1.4 to address the exception at startup - note we are actively working on completing support for Spring 6, but until then you might not see all the traces that you would get with previous releases of Spring.

@vallihalldors
Copy link

I am experiencing a similar issue after upgrading to version 1.1.x during startup of Wildfly application server when initializing web application context for a resteasy application that uses Spring to load the context. Could this be related?
11:04:54,777 ERROR [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 46) Context initialization failed: java.lang.IllegalStateException: RESTEASY013005: Could not convert 'datadog.trace.instrumentation.springweb.OrderedServletPathRequestFilter' to a class. at deployment.time.ear//org.jboss.resteasy.plugins.spring.SpringBeanProcessor.getBeanClass(SpringBeanProcessor.java:505) at deployment.time.ear//org.jboss.resteasy.plugins.spring.SpringBeanProcessor.getBeanClass(SpringBeanProcessor.java:414) at deployment.time.ear//org.jboss.resteasy.plugins.spring.SpringBeanProcessor.processBean(SpringBeanProcessor.java:306) at deployment.time.ear//org.jboss.resteasy.plugins.spring.SpringBeanProcessor.postProcessBeanFactory(SpringBeanProcessor.java:279) at deployment.time.ear//org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:325) at deployment.time.ear//org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:148) at deployment.time.ear//org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) at deployment.time.ear//org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) at deployment.time.ear//org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) at deployment.time.ear//com.betware.rest.resteasy.listener.BwSpringContextLoaderListener.configureAndRefreshWebApplicationContext(BwSpringContextLoaderListener.java:32) at deployment.time.ear//org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) at deployment.time.ear//org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) at deployment.time.ear//org.jboss.resteasy.plugins.spring.SpringContextLoaderListener.contextInitialized(SpringContextLoaderListener.java:57) at io.undertow.servlet@2.2.17.Final//io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) at io.undertow.servlet@2.2.17.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:219) at io.undertow.servlet@2.2.17.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:187) at io.undertow.servlet@2.2.17.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet@2.2.17.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at org.wildfly.extension.undertow@26.1.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544) at org.wildfly.extension.undertow@26.1.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544) at org.wildfly.extension.undertow@26.1.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544) at org.wildfly.extension.undertow@26.1.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544) at io.undertow.servlet@2.2.17.Final//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:255) at org.wildfly.extension.undertow@26.1.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:105) at org.wildfly.extension.undertow@26.1.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:87) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990) at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads@2.4.0.Final//org.jboss.threads.JBossThread.run(JBossThread.java:513) Caused by: java.lang.ClassNotFoundException: datadog.trace.instrumentation.springweb.OrderedServletPathRequestFilter from [Module "deployment.time.ear.time-cc.war" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:398) at deployment.time.ear//org.springframework.util.ClassUtils.forName(ClassUtils.java:284) at deployment.time.ear//org.jboss.resteasy.plugins.spring.SpringBeanProcessor.getBeanClass(SpringBeanProcessor.java:501) ... 32 more

@mcculls
Copy link
Contributor

mcculls commented Dec 2, 2022

@vallihalldors which version of the Java tracer are you using? If you're using 1.1.4 please open a new issue with as much detail as you can share about how to recreate it (version of Wildfly, RESTEasy, etc.)

@vallihalldors
Copy link

@mcculls I am using version 1.1.4. I will open a new issue.

@mcculls
Copy link
Contributor

mcculls commented Dec 2, 2022

Thanks @vallihalldors - looking at the stacktrace, I believe it's a separate issue related to class-loader visibility

@vallihalldors
Copy link

Thanks @mcculls I've submitted this issue #4368

@devinsba devinsba changed the title Incompatibility with Spring Framework 3.0.0 Incompatibility with Spring Boot 3.0.0 Dec 2, 2022
@joschi
Copy link

joschi commented Feb 13, 2023

Would this issue be addressed with #4605 being released in https://github.com/DataDog/dd-trace-java/releases/tag/v1.7.0?

@mcculls
Copy link
Contributor

mcculls commented Feb 13, 2023

The OrderedServletPathRequestFilter exception in the original report was fixed in 1.5.0

The 1.7.0 release added support for Spring Boot 3 and Spring Web (MVC) 6

@bm1549 bm1549 closed this as completed Nov 17, 2023
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

6 participants