You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Christian Schneider (JIRA)" <ji...@apache.org> on 2015/08/07 17:25:47 UTC

[jira] [Created] (KARAF-3908) shell:new does not work for most classes

Christian Schneider created KARAF-3908:
------------------------------------------

             Summary: shell:new does not work for most classes
                 Key: KARAF-3908
                 URL: https://issues.apache.org/jira/browse/KARAF-3908
             Project: Karaf
          Issue Type: Bug
          Components: karaf-shell
    Affects Versions: 4.0.0
            Reporter: Christian Schneider
            Assignee: Christian Schneider
             Fix For: 4.0.1


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.







--
This message was sent by Atlassian JIRA
(v6.3.4#6332)