Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17417

Spring logs a nasty looking stack trace for unhandled classpath URL

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.3.20, 5.0.10
    • Fix Version/s: 4.3.21, 5.0.11, 5.1.2
    • Component/s: Core
    • Labels:
      None

      Description

      Manifold adds a URL with custom protocol, manifoldclass: to the classpath, which is supported by URLClassLoader.  However, Spring assumes classpath URLs are file-based when it scans the classpath during SpringApplication.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)

        Attachments

          Activity

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              rsmckinney rsmckinney
              Last updater:
              Spring Issuemaster
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                47 weeks, 5 days ago