Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-3908

shell:new does not work for most classes

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.0
    • Fix Version/s: 4.0.1
    • Component/s: karaf
    • Labels:
      None

      Description

      If you do shell:new for a class that is not directly known to the shell.command bundle you get a ClassNotFoundException.

      The reason is that the DefaultConverter is used to convert from String to Class which uses the bundle classloader. The shell.commands bundle can not know all possible classes.

      A workaround is the do "dynamic-import org.apache.karaf.shell.commands" to make all packages available to the bundle. This opens a lot of possible problems though.

      So I think a proper solution would be to use the capabilties to find the bundle that exports the package and use the classloader of this bundle to load the class.

      In case there are multiple versions of the package we could allow to specify a bundle to import the package from or allow to specify a version range for the package.

        Attachments

          Activity

            People

            • Assignee:
              chris@die-schneider.net Christian Schneider
              Reporter:
              chris@die-schneider.net Christian Schneider
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: