← All tasks
javabaomidou/dynamic-datasource #471Not a task: not reproduced

Dynamic Datasource not judging Jakarta EE namespace when using SPEL

envgap__baomidou__dynamic-datasource-471

01 / FAILURE SIGNATURE

As reported upstream

Caused by: jakarta.servlet.ServletException: Handler dispatch failed: java.lang.NoSuchMethodError: 'javax.servlet.http.HttpServletRequest org.springframework.web.context.request.ServletRequestAttributes.getRequest()'
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
e2e176d5a8b17c6e3a70bcb66ffc86dca6b30a19
Manifest
pom.xml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

baomidou/dynamic-datasource #471 · read the original issue
Please fill it out carefully, or it will be closed.

请认真填写,不然会直接关闭。



# Enviroment



JDK Version(required): 



- `17`



SpringBoot Version(required): 



- `3.0.1`



dynamic-datasource-spring-boot-starter Version(required):



- `3.6.1`



druid Version(optional):



- Null.



# Describe what happened



- Dynamic Datasource not judging Jakarta EE namespace when using SPEL.

- Found at https://github.com/oracle/graalvm-reachability-metadata/pull/154 and https://github.com/linghengqian/graalvm-trace-metadata-smoketest/issues/1 .



Expected Result:



- Normal.



Actual Result:



- An error occurred.





If there is an exception,or aop invalid,please attach the exception trace:



```

Caused by: jakarta.servlet.ServletException: Handler dispatch failed: java.lang.NoSuchMethodError: 'javax.servlet.http.HttpServletRequest org.springframework.web.context.request.ServletRequestAttributes.getRequest()'

	at app//org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1095)

	at app//org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973)

	at app//org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1010)

	at app//org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:902)

	at app//jakarta.servlet.http.HttpServlet.service(HttpServlet.java:705)

	at app//org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:884)

	at app//org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:72)

	at app//jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814)

	at app//org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(MockFilterChain.java:165)

	at app//org.springframework.mock.web.MockFilterChain.doFilter(MockFilterChain.java:132)

	at app//org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:201)

	at app//com.lingh.dynamicdatasourcespeltest.SPELTest.lambda$testSPEL$0(SPELTest.java:67)

	at app//org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:49)

	... 88 more

Caused by: java.lang.NoSuchMethodError: 'javax.servlet.http.HttpServletRequest org.springframework.web.context.request.ServletRequestAttributes.getRequest()'

	at com.baomidou.dynamic.datasource.processor.jakarta.DsJakartaSessionProcessor.doDetermineDatasource(DsJakartaSessionProcessor.java:43)

	at com.baomidou.dynamic.datasource.processor.DsProcessor.determineDatasource(DsProcessor.java:53)

	at com.baomidou.dynamic.datasource.processor.DsProcessor.determineDatasource(DsProcessor.java:60)

	at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.determineDatasourceKey(DynamicDataSourceAnnotationInterceptor.java:58)

	at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.invoke(DynamicDataSourceAnnotationInterceptor.java:47)

	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)

	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752)

	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703)

	at com.lingh.dynamicdatasourcespeltest.service.spel.UserService$$SpringCGLIB$$0.selectSpelBySession(<generated>)

	at com.lingh.dynamicdatasourcespeltest.controller.UserController.session(UserController.java:23)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

	at java.base/java.lang.reflect.Method.invoke(Method.java:568)

	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207)

	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:152)

	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)

	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:884)

	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)

	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1080)

	... 100 more

```





# Steps to reproduce



- git at https://github.com/linghengqian/dynamic-datasource-spel-test .

- Execute the following commands.

```shell

git clone git@github.com:linghengqian/dynamic-datasource-spel-test.git

cd ./dynamic-datasource-spel-test

sdk use java 22.3.r17-grl

./gradlew clean test

```





Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]