Spring logs a nasty looking stack trace for unhandled classpath URL [SPR-17417] #21950
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
rsmckinney opened SPR-17417 and commented
Manifold adds a URL with custom protocol,
manifoldclass:
to the classpath, which is supported byURLClassLoader
. However, Spring assumes classpath URLs are file-based when it scans the classpath duringSpringApplication.run()
.If Spring encounters a URL that is not file-based, it throws a
FileNotFoundException
it subsequently catches and logs a warning. But it still logs the stack trace to the console, which is alarming if not misleading.Better: omit the stack trace from the warning message.
Best: provide an API or convention to handle a non-file protocol, or exclude it from the scan.
Log
:: Spring Boot :: (v2.0.6.RELEASE) :: Spring Boot :: (v2.0.6.RELEASE)
2018-10-20 11:48:01.252 INFO 18328 — [ main] com.example.demo.DemoApplication : Starting DemoApplication on LAPTOP-1OGNGP8A with PID 18328 (C:\Temp\spring\demo\demo\target\classes started by scott in C:\Temp\spring\demo\demo)2018-10-20 11:48:01.258 INFO 18328 — [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default2018-10-20 11:48:01.313 INFO 18328 — [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1f97cf0d: startup date [Sat Oct 20 11:48:01 PDT 2018]; root of context hierarchy2018-10-20 11:48:01.413 *WARN 18328 — [ main] .i.s.PathMatchingResourcePatternResolver : Cannot search for matching files underneath URL [manifoldclass://414493378/com/example/demo/] because it does not correspond to a directory in the file system*
java.io.FileNotFoundException: URL [manifoldclass://414493378/com/example/demo/] cannot be resolved to absolute file path because it does not reside in the file system: manifoldclass://414493378/com/example/demo/ at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:217) ~[spring-core-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:131) ~[spring-core-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.core.io.UrlResource.getFile(UrlResource.java:225) ~[spring-core-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:697) [spring-core-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:510) [spring-core-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:282) [spring-core-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1307) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.support.GenericApplicationContext.getResources(GenericApplicationContext.java:233) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:421) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:275) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:288) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:91) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:692) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:530) [spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE] at com.example.demo.DemoApplication.main(DemoApplication.java:12) [classes/:na]
2018-10-20 11:48:01.931 INFO 18328 — [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup2018-10-20 11:48:01.944 INFO 18328 — [ main] com.example.demo.DemoApplication : Started DemoApplication in 1.088 seconds (JVM running for 2.041)
Affects: 4.3.20, 5.0.10
Reference URL: manifold-systems/manifold#22
Backported to: 5.0.11, 4.3.21
The text was updated successfully, but these errors were encountered: