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

shell:new does not work for most classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0.0
    • 4.0.1
    • karaf
    • 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

            cschneider Christian Schneider
            cschneider Christian Schneider
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: