Spring OSGi
  1. Spring OSGi
  2. OSGI-818

OsgiBundleResource throws an exception when using "getFile()"

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: EXTENDER
    • Labels:
    • Environment:
      Spring [3.0.5], Spring-DM [1.2.1], Karaf [2.2.0]

      Description

      When calling "Resource.getFile()" in osgi environment (Resource implementation is OsgiBundleResource)
      an exception occurs:
      java.io.FileNotFoundException: OSGi
      resource[classpath:/repo/test.db4o|bnd.id=258|bnd.sym=taxonomydaoimplbundle]
      cannot be resolved to absolute file path because it does not reside in
      the file system: bundle://258.0:1/repo/test.db4o"

      See cause in forum thread:
      http://forum.springsource.org/showthread.php?110622-Spring-resource-classpath-issue

        Activity

        Hide
        Vadim Shaigorodskiy added a comment -

        Possible workarund is using "URL" or "InputStream" instead of "File".

        Show
        Vadim Shaigorodskiy added a comment - Possible workarund is using "URL" or "InputStream" instead of "File".
        Hide
        Costin Leau added a comment -

        getFile() should return a File handler for the underlying resource (not its content). In case of OSGi that's impossible since in most cases there are no actual files hence the exception. One can use getUrl() or getInputStream(); both are supported - however returning a File isn't.

        Show
        Costin Leau added a comment - getFile() should return a File handler for the underlying resource (not its content). In case of OSGi that's impossible since in most cases there are no actual files hence the exception. One can use getUrl() or getInputStream(); both are supported - however returning a File isn't.

          People

          • Assignee:
            Costin Leau
            Reporter:
            Vadim Shaigorodskiy
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development