Hi,
I've upgraded from karaf 2.x to 3.0.2 (with shell namesapce 1.1) and the
custom commands are not working anymore.

Here is a sample command:

import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.AbstractAction;

@Command(scope = "my", name = "list", description = "a sample command")
public class ListCommand extends AbstractAction {

    @Argument(index = 0, name = "arg", description = "a sample
argument", required = false, multiValued = false)
    private String arg = null;

    protected Object doExecute() throws Exception {
        return new String[]{"Given parameter: ", arg == null ? "<not
given>" : arg};
    }
}


and the blueprint config:

    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0";>
        <command>
            <action class="my.sample.command.ListCommand" />
        </command>
    </command-bundle>


and finally the pom config:

<Import-Package>
       org.apache.karaf.shell.commands,
       org.apache.karaf.shell.console,
       *
</Import-Package>


but the command installation fails with following message:

org.osgi.service.blueprint.container.ComponentDefinitionException:
org.osgi.service.blueprint.container.ComponentDefinitionException:
Unable to find a matching factory method getScope on class
org.apache.karaf.shell.console.commands.NamespaceHandler for arguments
[my.sample.command.ListCommand] when instanciating bean #recipe-11
        at 
org.apache.aries.blueprint.di.MapRecipe.internalCreate(MapRecipe.java:115)
        at 
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.1]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[15:org.apache.aries.blueprint.core:1.4.1]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[15:org.apache.aries.blueprint.core:1.4.1]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[15:org.apache.aries.blueprint.core:1.4.1]
        at 
org.apache.aries.blueprint.container.ServiceRecipe.createRecipe(ServiceRecipe.java:440)
        at 
org.apache.aries.blueprint.container.ServiceRecipe.register(ServiceRecipe.java:165)


Am I missing anything here? any idea?
Thanks

Reply via email to