Closed rajmanojkrr closed 10 months ago
Workaround : added
@EnableAutoConfiguration(exclude = { WebMvcAutoConfiguration.class })
and initiailized the below to make it deploy
@Bean(name = "mvcHandlerMappingIntrospector")
public HandlerMappingIntrospector mvcHandlerMappingIntrospector() {
return new HandlerMappingIntrospector();
}
I'm seeing classgraph in the stacktrace which points to resource scanning. Are you using webjars by any chance?
Can you try with the classic nested jar implementation and report back here? See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support
Additionally several bugs have been fixed in that area so trying the latest 3.2.1-SNAPSHOT would also help.
Thanks!
@rajmanojkrr I've edited your comments to improve the formatting. You might want to check out this Mastering Markdown guide for future reference.
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support
I had the same problem. This workaround worked, but my REST APIs are not working with error, that
org.springframework.web.servlet.NoHandlerFoundException: No endpoint POST /j/api/v1/hl7/test/orm/.
at org.springframework.web.servlet.DispatcherServlet.noHandlerFound(DispatcherServlet.java:1304)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.springframework.web.filter.AbstractRequestLoggingFilter.doFilterInternal(AbstractRequestLoggingFilter.java:289)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.rpm365.api.common.Slf4jMDCFilter.doFilterInternal(Slf4jMDCFilter.java:74)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.rpm365.api.security.OWASPResponseHeadersFilter.doFilter(OWASPResponseHeadersFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:66)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231)
at org.springframework.security.web.ObservationFilterChainDecorator$FilterObservation$SimpleFilterObservation.lambda$wrap$1(ObservationFilterChainDecorator.java:479)
at org.springframework.security.web.ObservationFilterChainDecorator$AroundFilterObservation$SimpleAroundFilterObservation.lambda$wrap$1(ObservationFilterChainDecorator.java:340)
at org.springframework.security.web.ObservationFilterChainDecorator.lambda$wrapSecured$0(ObservationFilterChainDecorator.java:82)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:128)
at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:110)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:110)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at XXXXXXXXX.APITokenFromHeader.doFilterInternal(AuthenticationUsingAPITokenFromHeader.java:69)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.rpm365.api.security.AuthenticationUsingApiTokenBearerJWTTokenFromHeader.doFilterInternal(AuthenticationUsingApiTokenBearerJWTTokenFromHeader.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:150)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:150)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:150)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:150)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240)
at org.springframework.security.web.ObservationFilterChainDecorator$AroundFilterObservation$SimpleAroundFilterObservation.lambda$wrap$0(ObservationFilterChainDecorator.java:323)
at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:224)
at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:352)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:268)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at java.base/java.lang.VirtualThread.run(VirtualThread.java:311)
@shivtrpm I'm glad the workaround worked for you. Can you try with the snapshot version as well? This would tell us if the bug is already fixed. If not, we would need a minimal sample application to reproduce it and work on a fix. Thanks!
I am also Using getting this error but weird this is when i am running in local, it works fine but during deployment it is giving me this error. Any idea about this. Recently we migrated deployment tool and after that this error arises
@mohitmalviya1708 That sounds like a different problem since the loader code is only used when running uber jars. Can you please open a new issue with a reproducer?
Workaround : added
@EnableAutoConfiguration(exclude = { WebMvcAutoConfiguration.class })
and initiailized the below to make it deploy
@Bean(name = "mvcHandlerMappingIntrospector") public HandlerMappingIntrospector mvcHandlerMappingIntrospector() { return new HandlerMappingIntrospector(); }
This suggestion worked. Is there a permanent fix for this issue?
@shivtrpm we can't help unless you try to follow directions in this comment and report back with the results. It could be that the issue you're facing is a very different one.
In my case this is a problem with OpenApi (maybe dependencies)
@Configuration
public class SpringdocConfig implements WebMvcConfigurer {
Just temporarily removed all things connected with OpenApi, and all things start to work fine. No time for investigation, will return to fix later
I'm seeing classgraph in the stacktrace which points to resource scanning. Are you using webjars by any chance?
Can you try with the classic nested jar implementation and report back here? See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support
Additionally several bugs have been fixed in that area so trying the latest 3.2.1-SNAPSHOT would also help.
Thanks!
This works for me, thank you !
Thanks for the feedback @hervesimon
I'm closing this issue as a duplicate and we can reopen it if someone provides a minimal sample with Spring Boot 3.2.1 that still fails.
Does anyone know of a workaround to make it work without having to upgrade to spring-boot 3.2.1?
@DobreMihai-echo see https://github.com/spring-projects/spring-boot/issues/38636#issuecomment-1837195400
@bclozel Hello sir. I have tried what was mentioned there, and I still receive the same error as what OP posted here. I have added the loaderImplementation tag to the spring-boot-plugin. I also tried what OP mentioned with excluding the class, but that seems to exclude the whole security functionality.
@DobreMihai-echo is your application working with 3.2.1-SNAPSHOT? If not, please create a new issue with a minimal sample application that shows the problem.
@bclozel Unfortunately, I do not have access to the version 3.2.1-SNAPSHOT as it was not cleared by my company, so I can't provide you with an answer if it works or not. Which is why I was trying to find a workaround for the 3.2.0 version until it will be made available. The only think I can answer is that it worked with 3.1.6, and the only thing I changed was the spring boot version to 3.2.0. Anyway, thank you so much for trying to help, I really appreciate it. Have a great day!!
Hi @bclozel , I am facing this issue after upgrading to spring 3.2.1. As mentioned above by @ram0973 removing below configuration as a workaround make things work but in my case I dont know to remove it due to some dependencies on test and already built in logic. I am writing this to understand why this is not working in latest version of spring and if there will be any fix or how can I keep things running the way they are running in spring 3.1.* Thank you
public class SpringdocConfig implements WebMvcConfigurer {
Getting below error":
ERROR org.springframework.boot.SpringApplication {} - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'resourceHandlerMapping' threw exception with message: No ServletContext set
@SheheryarAamir please create a new issue with a minimal sample application that reproduces the problem and we'll have a look.
My reported issue was not reproducible in 3.2.1
It's fixed
I'm seeing classgraph in the stacktrace which points to resource scanning. Are you using webjars by any chance?
Can you try with the classic nested jar implementation and report back here? See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support
Additionally several bugs have been fixed in that area so trying the latest 3.2.1-SNAPSHOT would also help.
Thanks!
Can you clarify the connection to webjars? We ran into the same issue and fixed it first by switching to the classic nested jar implementation and then by removing a dependency using webjars and switching back to the default.
Edit: the problem was encountered in Spring Boot 3.2.1
Can you clarify the connection to webjars?
The WebJars locator scans the classpath at startup to locate webjars. The stacktrace shows webjars and classgraph being involved:
Caused by: io.github.classgraph.ClassGraphException: Uncaught exception during scan
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1558)
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1575)
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1588)
at org.webjars.WebJarAssetLocator.scanForWebJars(WebJarAssetLocator.java:188)
at org.webjars.WebJarAssetLocator.<init>(WebJarAssetLocator.java:210)
at org.webjars.WebJarAssetLocator.<init>(WebJarAssetLocator.java:194)
at org.springframework.web.servlet.resource.WebJarsResourceResolver.<init>(WebJarsResourceResolver.java:63)
at org.springframework.web.servlet.config.annotation.ResourceChainRegistration.getResourceResolvers(ResourceChainRegistration.java:114)
at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.getRequestHandler(ResourceHandlerRegistration.java:235)
at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry.getRequestHandler(ResourceHandlerRegistry.java:178)
at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry.getHandlerMapping(ResourceHandlerRegistry.java:168)
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.resourceHandlerMapping(WebMvcConfigurationSupport.java:589)
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.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140)
... 87 common frames omitted
Caused by: java.lang.UnsupportedOperationException: Unable to resolve nested path
at org.springframework.boot.loader.nio.file.NestedPath.resolve(NestedPath.java:130)
at java.base/java.nio.file.Path.resolve(Path.java:515)
at io.github.classgraph.Scanner$2.newInstance(Scanner.java:479)
at io.github.classgraph.Scanner$2.newInstance(Scanner.java:388)
at nonapi.io.github.classgraph.concurrency.SingletonMap.get(SingletonMap.java:189)
at io.github.classgraph.Scanner$3.processWorkUnit(Scanner.java:583)
at io.github.classgraph.Scanner$3.processWorkUnit(Scanner.java:574)
at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkLoop(WorkQueue.java:246)
at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkQueue(WorkQueue.java:161)
at io.github.classgraph.Scanner.processWorkUnits(Scanner.java:342)
at io.github.classgraph.Scanner.openClasspathElementsThenScan(Scanner.java:1057)
at io.github.classgraph.Scanner.call(Scanner.java:1156)
at io.github.classgraph.Scanner.call(Scanner.java:83)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
We ran into the same issue and fixed it first by switching to the classic nested jar implementation and then by removing a dependency using webjars and switching back to the default.
If you still encounter errors like this with the latest Spring Boot 3.2.2 version and the new nested jar implementation, please create a new issue with a minimal project that reproduces the problem.
Can you clarify the connection to webjars?
The WebJars locator scans the classpath at startup to locate webjars. The stacktrace shows webjars and classgraph being involved:
Caused by: io.github.classgraph.ClassGraphException: Uncaught exception during scan at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1558) at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1575) at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1588) at org.webjars.WebJarAssetLocator.scanForWebJars(WebJarAssetLocator.java:188) at org.webjars.WebJarAssetLocator.<init>(WebJarAssetLocator.java:210) at org.webjars.WebJarAssetLocator.<init>(WebJarAssetLocator.java:194) at org.springframework.web.servlet.resource.WebJarsResourceResolver.<init>(WebJarsResourceResolver.java:63) at org.springframework.web.servlet.config.annotation.ResourceChainRegistration.getResourceResolvers(ResourceChainRegistration.java:114) at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.getRequestHandler(ResourceHandlerRegistration.java:235) at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry.getRequestHandler(ResourceHandlerRegistry.java:178) at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry.getHandlerMapping(ResourceHandlerRegistry.java:168) at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.resourceHandlerMapping(WebMvcConfigurationSupport.java:589) 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.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) ... 87 common frames omitted Caused by: java.lang.UnsupportedOperationException: Unable to resolve nested path at org.springframework.boot.loader.nio.file.NestedPath.resolve(NestedPath.java:130) at java.base/java.nio.file.Path.resolve(Path.java:515) at io.github.classgraph.Scanner$2.newInstance(Scanner.java:479) at io.github.classgraph.Scanner$2.newInstance(Scanner.java:388) at nonapi.io.github.classgraph.concurrency.SingletonMap.get(SingletonMap.java:189) at io.github.classgraph.Scanner$3.processWorkUnit(Scanner.java:583) at io.github.classgraph.Scanner$3.processWorkUnit(Scanner.java:574) at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkLoop(WorkQueue.java:246) at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkQueue(WorkQueue.java:161) at io.github.classgraph.Scanner.processWorkUnits(Scanner.java:342) at io.github.classgraph.Scanner.openClasspathElementsThenScan(Scanner.java:1057) at io.github.classgraph.Scanner.call(Scanner.java:1156) at io.github.classgraph.Scanner.call(Scanner.java:83) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)
We ran into the same issue and fixed it first by switching to the classic nested jar implementation and then by removing a dependency using webjars and switching back to the default.
If you still encounter errors like this with the latest Spring Boot 3.2.2 version and the new nested jar implementation, please create a new issue with a minimal project that reproduces the problem.
hi @bclozel In the version 3.2.2, for my project when i use Querydsl and add below dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>5.0.0</version>
<classifier>jakarta</classifier>
<scope>provided</scope>
</dependency>
will be got the same issue.
Those dependencies don't look related to this. Same advice as my previous comment.
If you still encounter errors like this with the latest Spring Boot 3.2.2 version and the new nested jar implementation, please create a new issue with a minimal project that reproduces the problem.
Those dependencies don't look related to this. Same advice as my previous comment.
If you still encounter errors like this with the latest Spring Boot 3.2.2 version and the new nested jar implementation, please create a new issue with a minimal project that reproduces the problem.
hi @bclozel i guess you just run by IDE(Idea), could u try to use command like java -jar xxx.jar again.
Those dependencies don't look related to this. Same advice as my previous comment.
If you still encounter errors like this with the latest Spring Boot 3.2.2 version and the new nested jar implementation, please create a new issue with a minimal project that reproduces the problem.
This actually was the reason in our case. In our IDE, the version for classgraph defined by webjars-locator-core (4.8.149) was used, but when we packaged the uber jar, the version defined by querydsl-apt (4.8.108) was used instead.
The issue also only occured on Linux systems. When running the uber jar on a windows machine, everything worked fine with 108, but when running on Linux (amazon-linux-2 or Ubuntu WSL2), we got the same error when 108 was included in the uber jar.
After fixing the version of classgraph, the application started on Ubuntu (WSL2), amazon-linux-2 test is still pending.
Those dependencies don't look related to this. Same advice as my previous comment.
If you still encounter errors like this with the latest Spring Boot 3.2.2 version and the new nested jar implementation, please create a new issue with a minimal project that reproduces the problem.
This actually was the reason in our case. In our IDE, the version for classgraph defined by webjars-locator-core (4.8.149) was used, but when we packaged the uber jar, the version defined by querydsl-apt (4.8.108) was used instead.
The issue also only occured on Linux systems. When running the uber jar on a windows machine, everything worked fine with 108, but when running on Linux (amazon-linux-2 or Ubuntu WSL2), we got the same error when 108 was included in the uber jar.
After fixing the version of classgraph, the application started on Ubuntu (WSL2), amazon-linux-2 test is still pending.
I think the querydsl-apt should not be packaged in boot jar. it just was used generate code during compile. so when i set up the dependency in plugin like below:
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>5.0.0</version>
<classifier>jakarta</classifier>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
there are no issues.
Use at least classgraph version 4.8.145 to fix the issue.
I had the same problem and as mentioned before, the problem was caused by classgraph version 4.8.143 in my case. This library is a dependency of springdoc-openapi-ui version 1.6.7 and I fixed upgrading springdoc-openapi-ui to version 1.7.0 which no longer uses classgraph.
@darruda , obrigado, tô 3 dias com esse problema, já rescrevi a parte do security 3 vezes hahah Obrigado <3
Spring boot app is not getting deployed with the below exception
It was working on 3.1.6
Issue exist in 3.2.0 , 3.2.1-Snapshop
Security Config:
Error creating bean with name