Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()'] with root cause java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()'

Today i faced a weird exception where in my spring boot app was throwing the below error :

2024-09-04T20:01:07.764-07:00 ERROR 2713 --- [xplore] [nio-8080-exec-2]

o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet

[dispatcherServlet] in context with path [] threw exception

[Request processing failed: java.lang.NoSuchMethodError:

'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()']

with root cause java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()' at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1125) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) ~[spring-webmvc-6.1.12.jar:6.1.12] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) ~[tomcat-embed-core-10.1.28.jar:6.0] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.1.12.jar:6.1.12] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.28.jar:6.0]


2024-09-04T20:01:07.789-07:00 ERROR 2713 --- [xplore] [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] threw exception java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()' at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1125) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springf


2024-09-04T20:01:07.790-07:00 ERROR 2713 --- [xplore] [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost] : Exception Processing [ErrorPage[errorCode=0, location=/error]] jakarta.servlet.ServletException: Request processing failed: java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()' at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1022) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) ~[spring-webmvc-6.1.12.jar:6.1.12] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) ~[tomcat-embed-core-10.1.28.jar:6.0] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.1.12.jar:6.1.12] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.28.jar:6.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195) ~[tomcat-embed-core-10.1.28.jar:10.1.28] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) ~[tomcat-embed-core-10.1.28.jar:10.1.28] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.1.4.jar:6.1.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.4.jar:6.1.4] at


After much research i figured out that this issue is because of having the same jar included with multiple versions.







If you see the pom file as in first and second image, i have defined two dependencies : spring-boot-starter-web and spring-web

Because of that there are two different versions of spring-web jar in the external libraries folder, Because of this i was facing the above error. Once i removed spring-web from dependencies then there were no longer multiple versions of same jar and so the issue got fixed. 





 

Comments

Popular posts from this blog

JPA Connect to multiple datasources

React Js : Text response is empty when using fetch