Spring Framework
  1. Spring Framework
  2. SPR-6592

context:component-scan broken for Eclipse/Equinox after upgrade to Spring 3.0

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0 GA
    • Fix Version/s: 3.0.1
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      After upgrading from Spring 2.5.6 to Spring 3.0.0.RELEASE, context:component-scan did not work anymore (see stack trace below).

      Inserting the line
      "rootDirResource = resolveRootDirResource(rootDirResource);"
      into PathMatchingResourcePatternResolver.findPathMatchingResources, line 343, directly after
      "for (Resource rootDirResource : rootDirResources) {"
      fixed it.

      Deployment-Scenario: The application resides in a jar inside an Eclipse RCP. The exception is thrown while instantiating a new ClassPathXmlApplicationContext.

      Stack trace:

      21:36:21,762 WARN org.springframework.core.io.support.PathMatchingResourcePatternResolver - Cannot search for matching files underneath URL [bundleresource://7.fwk1301078346/khoerder/traders/] because it does not correspond to a directory in the file system
      java.io.FileNotFoundException: URL [bundleresource://7.fwk1301078346/khoerder/traders/] cannot be resolved to absolute file path because it does not reside in the file system: bundleresource://7.fwk1301078346/khoerder/traders/
      at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:204)
      at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:51)
      at org.springframework.core.io.UrlResource.getFile(UrlResource.java:168)
      at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:529)
      at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:350)
      at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:269)
      at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1156)
      at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:204)
      ...

        Activity

        Hide
        Stefan Ocke added a comment -

        I don't think this is a minor issue, since it f.e. also breaks applications running on SpringDM server and using component-scan. Would be nice if this could be fixed for 3.0.1, since the fix proposed above seems minimal effort...

        Show
        Stefan Ocke added a comment - I don't think this is a minor issue, since it f.e. also breaks applications running on SpringDM server and using component-scan. Would be nice if this could be fixed for 3.0.1, since the fix proposed above seems minimal effort...
        Hide
        Stefan Ocke added a comment -

        Sorry, I would like to withdraw my comment above. I had the same exception, but my scenario was a bit different. I guess, my issue was related to not correctly injecting ResourceLoader.
        In summary I have not exactly reproduced the same error as described above, so I should not have claimed anything about it.

        Show
        Stefan Ocke added a comment - Sorry, I would like to withdraw my comment above. I had the same exception, but my scenario was a bit different. I guess, my issue was related to not correctly injecting ResourceLoader. In summary I have not exactly reproduced the same error as described above, so I should not have claimed anything about it.
        Hide
        Juergen Hoeller added a comment -

        Ouch - this was an accident when adding support for JBoss VFS: The resolveRootDirResource call accidentally got dropped... I re-added it for 3.0.1.

        This fix will be available in tonight's 3.0.1 snapshot. Feel free to give it try!

        Juergen

        Show
        Juergen Hoeller added a comment - Ouch - this was an accident when adding support for JBoss VFS: The resolveRootDirResource call accidentally got dropped... I re-added it for 3.0.1. This fix will be available in tonight's 3.0.1 snapshot. Feel free to give it try! Juergen

          People

          • Assignee:
            Juergen Hoeller
            Reporter:
            Kai Hoerder
            Last updater:
            Trevor Marshall
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              4 years, 14 weeks, 3 days ago