You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Stefan Eder <st...@ebuconnect.de> on 2011/05/14 01:56:33 UTC

'Command not found' when using Equinox

  Hi,

I have a problem extending the console with own commands, when I run 
Karaf with Equinox.

To check this problem again, I installed a simple "Hello World" command 
with blueprint and minimal dependencies on Karaf/Felix and on 
Karaf/Equinox, both in a virgin state (deleted data directory).

With Karaf/Felix the command is executed, with Karaf/Equinox it is not 
executed. Instead I get the error message "Command not found: hello:world".

I am running the latest release 2.2.1, build on my system, but I have 
also reproduced the problem with the 2.2.0 binary distribution.

The following log outputs appears only with Karaf/Felix:
org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle 
org.apache.karaf.shell.console [22] and service registration 
org.apache.felix.framework.ServiceRegistrationImpl@5cd5a2a9
org.apache.aries.blueprint - 0.3.0 | Creating service instance
org.apache.aries.blueprint - 0.3.0 | Service created: 
org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
org.apache.aries.blueprint - 0.3.0 | Creating listeners
org.apache.aries.blueprint - 0.3.0 | Listeners created: []
org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial 
service registration
org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args 
org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-181
org.apache.aries.blueprint - 0.3.0 | Instantiating component 
blueprintBundleContext

Up to this point the log output is equal with both frameworks (see below).

What might be the problem?

Stefan

osgi.test - 0.0.1 | BundleEvent INSTALLED
org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle 
org.apache.karaf.shell.console_2.2.0 [22] and service registration 
{org.apache.karaf.shell.console.CompletableFunction, 
org.apache.felix.service.command.Function}={osgi.command.function=start, 
osgi.command.scope=osgi, service.id=152}
org.apache.aries.blueprint - 0.3.0 | Creating service instance
org.apache.aries.blueprint - 0.3.0 | Service created: 
org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
org.apache.aries.blueprint - 0.3.0 | Creating listeners
org.apache.aries.blueprint - 0.3.0 | Listeners created: []
org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial 
service registration
org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args 
org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-135
org.apache.aries.blueprint - 0.3.0 | Instantiating component 
blueprintBundleContext
org.apache.aries.blueprint - 0.3.0 | Scanning bundle osgi.test for 
blueprint application
osgi.test - 0.0.1 | BundleEvent RESOLVED
org.apache.aries.blueprint - 0.3.0 | Found blueprint application in 
bundle osgi.test with paths: 
[bundleentry://42.fwk572511714/OSGI-INF/blueprint/commands.xml]
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state Unknown
org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event 
BlueprintEvent[type=CREATING] for bundle osgi.test
org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to 
Creating for bundle 42
osgi.test - 0.0.1 | BundleEvent STARTED
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state WaitForNamespaceHandlers
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state Populated
org.apache.aries.blueprint - 0.3.0 | Tracking service references: []
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state WaitForInitialReferences
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state InitialReferencesSatisfied
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state WaitForInitialReferences2
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state Create
org.apache.aries.blueprint - 0.3.0 | Registering service shell-182 with 
interfaces [org.apache.karaf.shell.console.CompletableFunction, 
org.apache.felix.service.command.Function] and properties 
{osgi.command.function=world, osgi.command.scope=hello}
osgi.test - 0.0.1 | ServiceEvent REGISTERED
org.apache.aries.blueprint - 0.3.0 | Instantiating components: 
[blueprintContainer, blueprintBundle, blueprintBundleContext, 
blueprintConverter]
osgi.test - 0.0.1 | ServiceEvent REGISTERED
org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event 
BlueprintEvent[type=CREATED] for bundle osgi.test
org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to 
Created for bundle 42
org.apache.aries.blueprint - 0.3.0 | Running blueprint container for 
bundle osgi.test in state Created



Re: 'Command not found' when using Equinox

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Stefan,

Could you try to add org.apache.felix.service.command in the 
Import-Package statement ?
It's provided by org.apache.karaf.shell.commands artifact.

Regards
JB

On 05/14/2011 11:43 AM, Stefan Eder wrote:
> Hi Jean-Baptiste,
>
> Thank you.
> The default-activation attribute was not explicitly set, so implicitly
> it should have been eager.
> I tried it with both values: same result.
> JDK 1.5 or 1.6 makes no difference.
>
> I made org.apache.karaf/karaf/2.2.1 the parent POM of the hello world
> command POM (didn't help).
> This is the reason for the Apache stuff appearing in the manifest:
> Manifest-Version: 1.0
> Export-Package: com.isd.jm.karaf.cmd;uses:="org.apache.karaf.shell.con
> sole,org.apache.felix.gogo.commands"
> Built-By: Stefan
> Tool: Bnd-1.15.0
> Bundle-Name: Unnamed - org.apache.karaf:osgi.test:bundle:2.2.1
> Created-By: Apache Maven Bundle Plugin
> Bundle-Vendor: The Apache Software Foundation
> Build-Jdk: 1.6.0_22
> Bundle-Version: 2.2.1
> Bnd-LastModified: 1305363687364
> Bundle-ManifestVersion: 2
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Bundle-Description: The Apache Software Foundation provides support fo
> r the Apache community of open-source software projects. The Apach
> e projects are characterized by a collaborative, consensus based deve
> lopment process, an open and pragmatic software license, and a des
> ire to create high quality software that leads the way in its field.
> We consider ourselves not simply a group of projects sharing a ser
> ver, but rather a community of developers and users.
> Bundle-SymbolicName: osgi.test
> Bundle-DocURL: http://www.apache.org/
> Import-Package: org.apache.felix.gogo.commands;version="[0.6,1)",org.a
> pache.karaf.shell.console;version="[2.2,3)",org.osgi.service.blueprin
> t;version="[1.0.0,2.0.0)"
>
> Blueprint:
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> default-activation="eager">
> <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
> <command name="hello/world">
> <action class="com.isd.jm.karaf.cmd.HelloWorldCmd"/>
> </command>
> </command-bundle>
> </blueprint>
>
> Java:
> package com.isd.jm.karaf.cmd;
>
> import org.apache.felix.gogo.commands.Command;
> import org.apache.karaf.shell.console.OsgiCommandSupport;
>
> @Command(scope = "hello", name = "world")
> public class HelloWorldCmd extends OsgiCommandSupport
> {
> @Override
> protected Object doExecute() throws Exception
> {
> System.out.println("Hello World!");
> return null;
> }
> }
>
> POM:
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
>
> <parent>
> <groupId>org.apache.karaf</groupId>
> <artifactId>karaf</artifactId>
> <version>2.2.1</version>
> </parent>
> <artifactId>osgi.test</artifactId>
> <packaging>bundle</packaging>
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-source-plugin</artifactId>
> </plugin>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> </plugin>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <configuration>
> <instructions>
> <Export-Package>
> com.isd.jm.karaf.cmd
> </Export-Package>
> </instructions>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> <dependencies>
> <dependency>
> <groupId>org.apache.karaf.shell</groupId>
> <artifactId>org.apache.karaf.shell.console</artifactId>
> </dependency>
> </dependencies>
> </project>
>
> It is somehow weired, it is such a basic thing and the core Karaf
> commands work fine with Equinox...
>
> Regards, Stefan
>
> Am 14.05.2011 07:41, schrieb Jean-Baptiste Onofré:
>> Hi Stefan,
>>
>> in the OSGI-INF/blueprint/*.xml of your command, what's your
>> default-activation (eager or lazy) ?
>>
>> Could you try to use eager in place of lazy ?
>> Could you paste your MANIFEST also to see the OSGi package statements ?
>>
>> Thanks
>> Regards
>> JB
>>
>> On 05/14/2011 01:56 AM, Stefan Eder wrote:
>>> Hi,
>>>
>>> I have a problem extending the console with own commands, when I run
>>> Karaf with Equinox.
>>>
>>> To check this problem again, I installed a simple "Hello World" command
>>> with blueprint and minimal dependencies on Karaf/Felix and on
>>> Karaf/Equinox, both in a virgin state (deleted data directory).
>>>
>>> With Karaf/Felix the command is executed, with Karaf/Equinox it is not
>>> executed. Instead I get the error message "Command not found:
>>> hello:world".
>>>
>>> I am running the latest release 2.2.1, build on my system, but I have
>>> also reproduced the problem with the 2.2.0 binary distribution.
>>>
>>> The following log outputs appears only with Karaf/Felix:
>>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>>> org.apache.karaf.shell.console [22] and service registration
>>> org.apache.felix.framework.ServiceRegistrationImpl@5cd5a2a9
>>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>>> org.apache.aries.blueprint - 0.3.0 | Service created:
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>>> service registration
>>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-181
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>>> blueprintBundleContext
>>>
>>> Up to this point the log output is equal with both frameworks (see
>>> below).
>>>
>>> What might be the problem?
>>>
>>> Stefan
>>>
>>> osgi.test - 0.0.1 | BundleEvent INSTALLED
>>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>>> org.apache.karaf.shell.console_2.2.0 [22] and service registration
>>> {org.apache.karaf.shell.console.CompletableFunction,
>>> org.apache.felix.service.command.Function}={osgi.command.function=start,
>>> osgi.command.scope=osgi, service.id=152}
>>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>>> org.apache.aries.blueprint - 0.3.0 | Service created:
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>>> service registration
>>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-135
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>>> blueprintBundleContext
>>> org.apache.aries.blueprint - 0.3.0 | Scanning bundle osgi.test for
>>> blueprint application
>>> osgi.test - 0.0.1 | BundleEvent RESOLVED
>>> org.apache.aries.blueprint - 0.3.0 | Found blueprint application in
>>> bundle osgi.test with paths:
>>> [bundleentry://42.fwk572511714/OSGI-INF/blueprint/commands.xml]
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Unknown
>>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>>> BlueprintEvent[type=CREATING] for bundle osgi.test
>>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>>> Creating for bundle 42
>>> osgi.test - 0.0.1 | BundleEvent STARTED
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state WaitForNamespaceHandlers
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Populated
>>> org.apache.aries.blueprint - 0.3.0 | Tracking service references: []
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state WaitForInitialReferences
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state InitialReferencesSatisfied
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state WaitForInitialReferences2
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Create
>>> org.apache.aries.blueprint - 0.3.0 | Registering service shell-182 with
>>> interfaces [org.apache.karaf.shell.console.CompletableFunction,
>>> org.apache.felix.service.command.Function] and properties
>>> {osgi.command.function=world, osgi.command.scope=hello}
>>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating components:
>>> [blueprintContainer, blueprintBundle, blueprintBundleContext,
>>> blueprintConverter]
>>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>>> BlueprintEvent[type=CREATED] for bundle osgi.test
>>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>>> Created for bundle 42
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Created
>>>
>>>
>>
>>
>
>

Re: 'Command not found' when using Equinox

Posted by Ioannis Canellos <io...@gmail.com>.
I've encountered this issue in many projects I've worked on.
The last I can remember was jclouds-karaf and here's the commit that fixed
the issue:
https://github.com/jclouds/jclouds-karaf/commit/cb799c29cf268fe7a2ba121d74be5123fe25387c

-- 
*Ioannis Canellos*
*

**
Blog: http://iocanel.blogspot.com
**
Twitter: iocanel
*

Re: 'Command not found' when using Equinox

Posted by redfish <ke...@gmail.com>.
Ok, When I remove the version:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.emory.adapter.karaf.console
Bundle-SymbolicName: org.emory.adapter.karaf.console
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Blueprint: OSGI-INF/blueprint/*.xml
Import-Package: org.apache.felix.gogo.commands,
 org.apache.felix.service.command,
 org.apache.karaf.shell.console,
 org.osgi.framework


I get the same error:
2012-09-18 12:38:12,689 | WARN  | -C:\Karaf/deploy | fileinstall                     
| 6 - org.apache.felix.fileinstall - 3.2.4 | Error while starting bundle:
file:/C:/Karaf/deploy/org.emory.adapter.
karaf.console_1.0.0.201209181237.jar
org.osgi.framework.BundleException: The bundle
"org.emory.adapter.karaf.console_1.0.0.201209181237 [102]" could not be
resolved. Reason: Missing Constraint: Import-Package:
org.apache.felix.service.co
mmand; version="0.0.0" at
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1317)[osgi-3.6.2.R36x_v20110210.jar:]

Any ideas?





--
View this message in context: http://karaf.922171.n3.nabble.com/Command-not-found-when-using-Equinox-tp2939669p4026075.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: 'Command not found' when using Equinox

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
No Maven is not a requirement.

Could you try to avoid the version on the package ?

Regards
JB

On 09/18/2012 05:01 PM, redfish wrote:
> I appreciate the help.
>
> I hope that maven isn't a requirement.  I thought I could set this up with
> out maven as long as I get the manifest and the dependencies sorted out
> correctly.
>
> My Manifest:
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: org.emory.adapter.karaf.console
> Bundle-SymbolicName: org.emory.adapter.karaf.console
> Bundle-Version: 1.0.0.qualifier
> Bundle-RequiredExecutionEnvironment: J2SE-1.5
> Bundle-Blueprint: OSGI-INF/blueprint/*.xml
> Import-Package: org.apache.felix.gogo.commands,
>   org.apache.felix.service.command;version="0.10.0",
>   org.apache.karaf.shell.console,
>   org.osgi.framework
>
> Any ideas?
>
> Maybe if I could see a working example, ie: a built bundle that extends the
> console. I could inspect it to see what i'm doing wrong and/or I could load
> it in my karaf and see if it works as expected.
>
> Thanks!
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Command-not-found-when-using-Equinox-tp2939669p4026069.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: 'Command not found' when using Equinox

Posted by redfish <ke...@gmail.com>.
I appreciate the help. 

I hope that maven isn't a requirement.  I thought I could set this up with
out maven as long as I get the manifest and the dependencies sorted out
correctly.

My Manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.emory.adapter.karaf.console
Bundle-SymbolicName: org.emory.adapter.karaf.console
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Blueprint: OSGI-INF/blueprint/*.xml
Import-Package: org.apache.felix.gogo.commands,
 org.apache.felix.service.command;version="0.10.0",
 org.apache.karaf.shell.console,
 org.osgi.framework

Any ideas?

Maybe if I could see a working example, ie: a built bundle that extends the
console. I could inspect it to see what i'm doing wrong and/or I could load
it in my karaf and see if it works as expected.

Thanks!





--
View this message in context: http://karaf.922171.n3.nabble.com/Command-not-found-when-using-Equinox-tp2939669p4026069.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: 'Command not found' when using Equinox

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
In your bundle, did you define the import package ?

For instance, you should have something like:

             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
                         <Import-Package>
                             org.apache.felix.service.command,
                             org.apache.felix.gogo.commands,
                             org.apache.karaf.shell.console,
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
                     </instructions>
                 </configuration>
             </plugin>

in your bundle POM.

As org.apache.felix.service.command is not explicitly used in the code, 
maven-bundle-plugin/bnd doesn't import it automatically. That's why you 
have to add the statement the maven bundle config.

Regards
JB

On 09/18/2012 04:07 PM, redfish wrote:
> I loaded the Apache Felix Gogo Runtime (0.10.0) by droping
> org.apache.felix.gogo.runtime-0.10.0.jar into my deploy folder.  It loaded
> and started. shows active when listed from osgi:list
>
> I redeploy my bundle and get the same resolution issue:
> 2012-09-18 10:01:14,507 | WARN  | -C:\Karaf/deploy | fileinstall
> | 6 - org.apache.felix.fileinstall - 3.2.4 | Error while starting bundle:
> file:/C:/Karaf/deploy/org.emory.adapter.
> karaf.console_1.0.0.201209181000.jar
> org.osgi.framework.BundleException: The bundle
> "org.emory.adapter.karaf.console_1.0.0.201209181000 [101]" could not be
> resolved. Reason: Missing Constraint: Import-Package:
> org.apache.felix.service.co
> mmand; version="0.10.0" at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1317)[osgi-3.6.2.R36x_v20110210.jar:]
> .....
>
> Any ideas what I'm doing wrong?
> Is there an example that is already built that I can look?
> It seems like there are some basics that I'm just not understanding.
>
> Many thanks.
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Command-not-found-when-using-Equinox-tp2939669p4026067.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: 'Command not found' when using Equinox

Posted by redfish <ke...@gmail.com>.
I loaded the Apache Felix Gogo Runtime (0.10.0) by droping
org.apache.felix.gogo.runtime-0.10.0.jar into my deploy folder.  It loaded
and started. shows active when listed from osgi:list

I redeploy my bundle and get the same resolution issue:
2012-09-18 10:01:14,507 | WARN  | -C:\Karaf/deploy | fileinstall                     
| 6 - org.apache.felix.fileinstall - 3.2.4 | Error while starting bundle:
file:/C:/Karaf/deploy/org.emory.adapter.
karaf.console_1.0.0.201209181000.jar
org.osgi.framework.BundleException: The bundle
"org.emory.adapter.karaf.console_1.0.0.201209181000 [101]" could not be
resolved. Reason: Missing Constraint: Import-Package:
org.apache.felix.service.co
mmand; version="0.10.0" at
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1317)[osgi-3.6.2.R36x_v20110210.jar:]
.....

Any ideas what I'm doing wrong?
Is there an example that is already built that I can look?
It seems like there are some basics that I'm just not understanding.

Many thanks.




--
View this message in context: http://karaf.922171.n3.nabble.com/Command-not-found-when-using-Equinox-tp2939669p4026067.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: 'Command not found' when using Equinox

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

org.apache.felix.service.command is not provided by Karaf console (only 
org.apache.felix.gogo.*).

The org.apache.felix.service.command is provided by 
org.apache.felix.gogo.runtime (also imported in the Karaf console as a 
private package).

Regards
JB

On 09/17/2012 07:48 PM, redfish wrote:
> Hi,
> I'm having the same issue as you but I've not been able to resolve by adding
> org.apache.felix.service.command to my package import.
>
> I'm using equinox in Karaf 2.2.9 and trying to follow the example for
> extending the console.  I'm using eclipse without maven.  So, i'm having to
> put this together based on what I think it needs to be.
>
> So, I got to the same spot as you.  I loaded the bundle with the example
> command and got command not found when I tried to execute it.  I added the
> org.apache.felix.service.command to my package import but now the bundle
> won't load.
>
> The bundle fails to load with the following error:
> org.osgi.framework.BundleException: The bundle
> "org.emory.adapter.karaf.console_1.0.0.201209171331 [56]" could not be
> resolved. Reason: Missing Constraint: Import-Package:
> org.apache.felix.service.com
> mand; version="0.0.0" at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1317)[osgi-3.6.2.R36x_v20110210.jar:]
> .....
>
> What am I missing, I thought this package was provided by the karaf console
> bundle (I must be wrong).  Is there another dependency that needs to be
> loaded.   Or am I goofing something else up?
>
> Here are some details:
> My Manifest:
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: org.emory.adapter.karaf.console
> Bundle-SymbolicName: org.emory.adapter.karaf.console
> Bundle-Version: 1.0.0.qualifier
> Bundle-RequiredExecutionEnvironment: J2SE-1.5
> Bundle-Blueprint: OSGI-INF/blueprint/*.xml
> Import-Package: org.apache.felix.gogo.commands,
>   org.apache.felix.service.command,
>   org.apache.karaf.shell.console,
>   org.osgi.framework
>
> My Class:
> package org.emory.adapter.karaf.console;
> import org.apache.felix.gogo.commands.Command;
> import org.apache.karaf.shell.console.OsgiCommandSupport;
> @Command(scope = "test", name = "hello", description="Says hello")
> public class HelloShellCommand extends OsgiCommandSupport {
>      @Override
>      protected Object doExecute() throws Exception {
>          System.out.println("Executing Hello command");
>          return null;
>      }
> }
>
> My Blueprint:
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>   <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
>          <command name="test/hello">
>              <action
> class="org.apache.karaf.shell.samples.HelloShellCommand"/>
>          </command>
>      </command-bundle>
> </blueprint>
>
> Karaf Version 2.2.9 on Windows7 with sun 6.1 jre.
>
> Let me know if any questions or if there is any doc that can assist.
>
> This is my last hurdle to getting my codebase up and running with Karaf.
>
> Thank you so much.
>
>
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Command-not-found-when-using-Equinox-tp2939669p4026053.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: 'Command not found' when using Equinox

Posted by redfish <ke...@gmail.com>.
Hi,
I'm having the same issue as you but I've not been able to resolve by adding
org.apache.felix.service.command to my package import.

I'm using equinox in Karaf 2.2.9 and trying to follow the example for
extending the console.  I'm using eclipse without maven.  So, i'm having to
put this together based on what I think it needs to be.

So, I got to the same spot as you.  I loaded the bundle with the example
command and got command not found when I tried to execute it.  I added the
org.apache.felix.service.command to my package import but now the bundle
won't load.

The bundle fails to load with the following error:
org.osgi.framework.BundleException: The bundle
"org.emory.adapter.karaf.console_1.0.0.201209171331 [56]" could not be
resolved. Reason: Missing Constraint: Import-Package:
org.apache.felix.service.com
mand; version="0.0.0" at
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1317)[osgi-3.6.2.R36x_v20110210.jar:]
.....

What am I missing, I thought this package was provided by the karaf console
bundle (I must be wrong).  Is there another dependency that needs to be
loaded.   Or am I goofing something else up?

Here are some details:
My Manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.emory.adapter.karaf.console
Bundle-SymbolicName: org.emory.adapter.karaf.console
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Blueprint: OSGI-INF/blueprint/*.xml
Import-Package: org.apache.felix.gogo.commands,
 org.apache.felix.service.command,
 org.apache.karaf.shell.console,
 org.osgi.framework

My Class:
package org.emory.adapter.karaf.console;
import org.apache.felix.gogo.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;
@Command(scope = "test", name = "hello", description="Says hello")
public class HelloShellCommand extends OsgiCommandSupport {
    @Override
    protected Object doExecute() throws Exception {
        System.out.println("Executing Hello command");
        return null;
    }
}

My Blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
        <command name="test/hello">
            <action
class="org.apache.karaf.shell.samples.HelloShellCommand"/>
        </command>
    </command-bundle>
</blueprint>

Karaf Version 2.2.9 on Windows7 with sun 6.1 jre.

Let me know if any questions or if there is any doc that can assist.  

This is my last hurdle to getting my codebase up and running with Karaf.

Thank you so much. 







--
View this message in context: http://karaf.922171.n3.nabble.com/Command-not-found-when-using-Equinox-tp2939669p4026053.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: 'Command not found' when using Equinox

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
I just see your answer.

Good,
Regards
JB

On 05/14/2011 11:19 PM, Stefan Eder wrote:
> Hi,
>
> I figured it out.
> The package import "org.apache.felix.service.command" in the manifest
> makes the difference.
> If absent the command is only executed with Felix as framework.
> If present the command is also executed with Equinox as framework.
>
> Thanks,
> Stefan
>
> Am 14.05.2011 11:43, schrieb Stefan Eder:
>> Hi Jean-Baptiste,
>>
>> Thank you.
>> The default-activation attribute was not explicitly set, so implicitly
>> it should have been eager.
>> I tried it with both values: same result.
>> JDK 1.5 or 1.6 makes no difference.
>>
>> I made org.apache.karaf/karaf/2.2.1 the parent POM of the hello world
>> command POM (didn't help).
>> This is the reason for the Apache stuff appearing in the manifest:
>> Manifest-Version: 1.0
>> Export-Package: com.isd.jm.karaf.cmd;uses:="org.apache.karaf.shell.con
>> sole,org.apache.felix.gogo.commands"
>> Built-By: Stefan
>> Tool: Bnd-1.15.0
>> Bundle-Name: Unnamed - org.apache.karaf:osgi.test:bundle:2.2.1
>> Created-By: Apache Maven Bundle Plugin
>> Bundle-Vendor: The Apache Software Foundation
>> Build-Jdk: 1.6.0_22
>> Bundle-Version: 2.2.1
>> Bnd-LastModified: 1305363687364
>> Bundle-ManifestVersion: 2
>> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>> Bundle-Description: The Apache Software Foundation provides support fo
>> r the Apache community of open-source software projects. The Apach
>> e projects are characterized by a collaborative, consensus based deve
>> lopment process, an open and pragmatic software license, and a des
>> ire to create high quality software that leads the way in its field.
>> We consider ourselves not simply a group of projects sharing a ser
>> ver, but rather a community of developers and users.
>> Bundle-SymbolicName: osgi.test
>> Bundle-DocURL: http://www.apache.org/
>> Import-Package: org.apache.felix.gogo.commands;version="[0.6,1)",org.a
>> pache.karaf.shell.console;version="[2.2,3)",org.osgi.service.blueprin
>> t;version="[1.0.0,2.0.0)"
>>
>> Blueprint:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> default-activation="eager">
>> <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
>> <command name="hello/world">
>> <action class="com.isd.jm.karaf.cmd.HelloWorldCmd"/>
>> </command>
>> </command-bundle>
>> </blueprint>
>>
>> Java:
>> package com.isd.jm.karaf.cmd;
>>
>> import org.apache.felix.gogo.commands.Command;
>> import org.apache.karaf.shell.console.OsgiCommandSupport;
>>
>> @Command(scope = "hello", name = "world")
>> public class HelloWorldCmd extends OsgiCommandSupport
>> {
>> @Override
>> protected Object doExecute() throws Exception
>> {
>> System.out.println("Hello World!");
>> return null;
>> }
>> }
>>
>> POM:
>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>> <modelVersion>4.0.0</modelVersion>
>>
>> <parent>
>> <groupId>org.apache.karaf</groupId>
>> <artifactId>karaf</artifactId>
>> <version>2.2.1</version>
>> </parent>
>> <artifactId>osgi.test</artifactId>
>> <packaging>bundle</packaging>
>>
>> <build>
>> <plugins>
>> <plugin>
>> <artifactId>maven-source-plugin</artifactId>
>> </plugin>
>> <plugin>
>> <artifactId>maven-compiler-plugin</artifactId>
>> </plugin>
>> <plugin>
>> <groupId>org.apache.felix</groupId>
>> <artifactId>maven-bundle-plugin</artifactId>
>> <configuration>
>> <instructions>
>> <Export-Package>
>> com.isd.jm.karaf.cmd
>> </Export-Package>
>> </instructions>
>> </configuration>
>> </plugin>
>> </plugins>
>> </build>
>>
>> <dependencies>
>> <dependency>
>> <groupId>org.apache.karaf.shell</groupId>
>> <artifactId>org.apache.karaf.shell.console</artifactId>
>> </dependency>
>> </dependencies>
>> </project>
>>
>> It is somehow weired, it is such a basic thing and the core Karaf
>> commands work fine with Equinox...
>>
>> Regards, Stefan
>>
>> Am 14.05.2011 07:41, schrieb Jean-Baptiste Onofré:
>>> Hi Stefan,
>>>
>>> in the OSGI-INF/blueprint/*.xml of your command, what's your
>>> default-activation (eager or lazy) ?
>>>
>>> Could you try to use eager in place of lazy ?
>>> Could you paste your MANIFEST also to see the OSGi package statements ?
>>>
>>> Thanks
>>> Regards
>>> JB
>>>
>>> On 05/14/2011 01:56 AM, Stefan Eder wrote:
>>>> Hi,
>>>>
>>>> I have a problem extending the console with own commands, when I run
>>>> Karaf with Equinox.
>>>>
>>>> To check this problem again, I installed a simple "Hello World" command
>>>> with blueprint and minimal dependencies on Karaf/Felix and on
>>>> Karaf/Equinox, both in a virgin state (deleted data directory).
>>>>
>>>> With Karaf/Felix the command is executed, with Karaf/Equinox it is not
>>>> executed. Instead I get the error message "Command not found:
>>>> hello:world".
>>>>
>>>> I am running the latest release 2.2.1, build on my system, but I have
>>>> also reproduced the problem with the 2.2.0 binary distribution.
>>>>
>>>> The following log outputs appears only with Karaf/Felix:
>>>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>>>> org.apache.karaf.shell.console [22] and service registration
>>>> org.apache.felix.framework.ServiceRegistrationImpl@5cd5a2a9
>>>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>>>> org.apache.aries.blueprint - 0.3.0 | Service created:
>>>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>>>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>>>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>>>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>>>> service registration
>>>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>>>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-181
>>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>>>> blueprintBundleContext
>>>>
>>>> Up to this point the log output is equal with both frameworks (see
>>>> below).
>>>>
>>>> What might be the problem?
>>>>
>>>> Stefan
>>>>
>>>> osgi.test - 0.0.1 | BundleEvent INSTALLED
>>>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>>>> org.apache.karaf.shell.console_2.2.0 [22] and service registration
>>>> {org.apache.karaf.shell.console.CompletableFunction,
>>>> org.apache.felix.service.command.Function}={osgi.command.function=start,
>>>>
>>>> osgi.command.scope=osgi, service.id=152}
>>>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>>>> org.apache.aries.blueprint - 0.3.0 | Service created:
>>>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>>>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>>>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>>>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>>>> service registration
>>>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>>>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-135
>>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>>>> blueprintBundleContext
>>>> org.apache.aries.blueprint - 0.3.0 | Scanning bundle osgi.test for
>>>> blueprint application
>>>> osgi.test - 0.0.1 | BundleEvent RESOLVED
>>>> org.apache.aries.blueprint - 0.3.0 | Found blueprint application in
>>>> bundle osgi.test with paths:
>>>> [bundleentry://42.fwk572511714/OSGI-INF/blueprint/commands.xml]
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state Unknown
>>>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>>>> BlueprintEvent[type=CREATING] for bundle osgi.test
>>>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>>>> Creating for bundle 42
>>>> osgi.test - 0.0.1 | BundleEvent STARTED
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state WaitForNamespaceHandlers
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state Populated
>>>> org.apache.aries.blueprint - 0.3.0 | Tracking service references: []
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state WaitForInitialReferences
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state InitialReferencesSatisfied
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state WaitForInitialReferences2
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state Create
>>>> org.apache.aries.blueprint - 0.3.0 | Registering service shell-182 with
>>>> interfaces [org.apache.karaf.shell.console.CompletableFunction,
>>>> org.apache.felix.service.command.Function] and properties
>>>> {osgi.command.function=world, osgi.command.scope=hello}
>>>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>>>> org.apache.aries.blueprint - 0.3.0 | Instantiating components:
>>>> [blueprintContainer, blueprintBundle, blueprintBundleContext,
>>>> blueprintConverter]
>>>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>>>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>>>> BlueprintEvent[type=CREATED] for bundle osgi.test
>>>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>>>> Created for bundle 42
>>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>>> bundle osgi.test in state Created
>>>>
>>>>
>>>
>>>
>>
>>
>>

Re: 'Command not found' when using Equinox

Posted by Stefan Eder <st...@ebuconnect.de>.
  Hi,

I figured it out.
The package import "org.apache.felix.service.command" in the manifest 
makes the difference.
If absent the command is only executed with Felix as framework.
If present the command is also executed with Equinox as framework.

Thanks,
Stefan

Am 14.05.2011 11:43, schrieb Stefan Eder:
>   Hi Jean-Baptiste,
>
> Thank you.
> The default-activation attribute was not explicitly set, so implicitly 
> it should have been eager.
> I tried it with both values: same result.
> JDK 1.5 or 1.6 makes no difference.
>
> I made org.apache.karaf/karaf/2.2.1 the parent POM of the hello world 
> command POM (didn't help).
> This is the reason for the Apache stuff appearing in the manifest:
> Manifest-Version: 1.0
> Export-Package: com.isd.jm.karaf.cmd;uses:="org.apache.karaf.shell.con
>  sole,org.apache.felix.gogo.commands"
> Built-By: Stefan
> Tool: Bnd-1.15.0
> Bundle-Name: Unnamed - org.apache.karaf:osgi.test:bundle:2.2.1
> Created-By: Apache Maven Bundle Plugin
> Bundle-Vendor: The Apache Software Foundation
> Build-Jdk: 1.6.0_22
> Bundle-Version: 2.2.1
> Bnd-LastModified: 1305363687364
> Bundle-ManifestVersion: 2
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Bundle-Description: The Apache Software Foundation provides support fo
>  r the Apache community of open-source software projects.    The Apach
>  e projects are characterized by a collaborative, consensus based deve
>  lopment process, an open and    pragmatic software license, and a des
>  ire to create high quality software that leads the way in its field.
>     We consider ourselves not simply a group of projects sharing a ser
>  ver, but rather a community of developers    and users.
> Bundle-SymbolicName: osgi.test
> Bundle-DocURL: http://www.apache.org/
> Import-Package: org.apache.felix.gogo.commands;version="[0.6,1)",org.a
>  pache.karaf.shell.console;version="[2.2,3)",org.osgi.service.blueprin
>  t;version="[1.0.0,2.0.0)"
>
> Blueprint:
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
> default-activation="eager">
> <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
> <command name="hello/world">
> <action class="com.isd.jm.karaf.cmd.HelloWorldCmd"/>
> </command>
> </command-bundle>
> </blueprint>
>
> Java:
> package com.isd.jm.karaf.cmd;
>
> import org.apache.felix.gogo.commands.Command;
> import org.apache.karaf.shell.console.OsgiCommandSupport;
>
> @Command(scope = "hello", name = "world")
> public class HelloWorldCmd extends OsgiCommandSupport
> {
>     @Override
>     protected Object doExecute() throws Exception
>     {
>         System.out.println("Hello World!");
>         return null;
>     }
> }
>
> POM:
> <project xmlns="http://maven.apache.org/POM/4.0.0" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
>
> <parent>
> <groupId>org.apache.karaf</groupId>
> <artifactId>karaf</artifactId>
> <version>2.2.1</version>
> </parent>
> <artifactId>osgi.test</artifactId>
> <packaging>bundle</packaging>
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-source-plugin</artifactId>
> </plugin>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> </plugin>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <configuration>
> <instructions>
> <Export-Package>
>                             com.isd.jm.karaf.cmd
> </Export-Package>
> </instructions>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> <dependencies>
> <dependency>
> <groupId>org.apache.karaf.shell</groupId>
> <artifactId>org.apache.karaf.shell.console</artifactId>
> </dependency>
> </dependencies>
> </project>
>
> It is somehow weired, it is such a basic thing and the core Karaf 
> commands work fine with Equinox...
>
> Regards, Stefan
>
> Am 14.05.2011 07:41, schrieb Jean-Baptiste Onofré:
>> Hi Stefan,
>>
>> in the OSGI-INF/blueprint/*.xml of your command, what's your 
>> default-activation (eager or lazy) ?
>>
>> Could you try to use eager in place of lazy ?
>> Could you paste your MANIFEST also to see the OSGi package statements ?
>>
>> Thanks
>> Regards
>> JB
>>
>> On 05/14/2011 01:56 AM, Stefan Eder wrote:
>>> Hi,
>>>
>>> I have a problem extending the console with own commands, when I run
>>> Karaf with Equinox.
>>>
>>> To check this problem again, I installed a simple "Hello World" command
>>> with blueprint and minimal dependencies on Karaf/Felix and on
>>> Karaf/Equinox, both in a virgin state (deleted data directory).
>>>
>>> With Karaf/Felix the command is executed, with Karaf/Equinox it is not
>>> executed. Instead I get the error message "Command not found: 
>>> hello:world".
>>>
>>> I am running the latest release 2.2.1, build on my system, but I have
>>> also reproduced the problem with the 2.2.0 binary distribution.
>>>
>>> The following log outputs appears only with Karaf/Felix:
>>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>>> org.apache.karaf.shell.console [22] and service registration
>>> org.apache.felix.framework.ServiceRegistrationImpl@5cd5a2a9
>>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>>> org.apache.aries.blueprint - 0.3.0 | Service created:
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>>> service registration
>>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-181
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>>> blueprintBundleContext
>>>
>>> Up to this point the log output is equal with both frameworks (see 
>>> below).
>>>
>>> What might be the problem?
>>>
>>> Stefan
>>>
>>> osgi.test - 0.0.1 | BundleEvent INSTALLED
>>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>>> org.apache.karaf.shell.console_2.2.0 [22] and service registration
>>> {org.apache.karaf.shell.console.CompletableFunction,
>>> org.apache.felix.service.command.Function}={osgi.command.function=start, 
>>>
>>> osgi.command.scope=osgi, service.id=152}
>>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>>> org.apache.aries.blueprint - 0.3.0 | Service created:
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>>> service registration
>>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-135
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>>> blueprintBundleContext
>>> org.apache.aries.blueprint - 0.3.0 | Scanning bundle osgi.test for
>>> blueprint application
>>> osgi.test - 0.0.1 | BundleEvent RESOLVED
>>> org.apache.aries.blueprint - 0.3.0 | Found blueprint application in
>>> bundle osgi.test with paths:
>>> [bundleentry://42.fwk572511714/OSGI-INF/blueprint/commands.xml]
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Unknown
>>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>>> BlueprintEvent[type=CREATING] for bundle osgi.test
>>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>>> Creating for bundle 42
>>> osgi.test - 0.0.1 | BundleEvent STARTED
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state WaitForNamespaceHandlers
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Populated
>>> org.apache.aries.blueprint - 0.3.0 | Tracking service references: []
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state WaitForInitialReferences
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state InitialReferencesSatisfied
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state WaitForInitialReferences2
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Create
>>> org.apache.aries.blueprint - 0.3.0 | Registering service shell-182 with
>>> interfaces [org.apache.karaf.shell.console.CompletableFunction,
>>> org.apache.felix.service.command.Function] and properties
>>> {osgi.command.function=world, osgi.command.scope=hello}
>>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>>> org.apache.aries.blueprint - 0.3.0 | Instantiating components:
>>> [blueprintContainer, blueprintBundle, blueprintBundleContext,
>>> blueprintConverter]
>>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>>> BlueprintEvent[type=CREATED] for bundle osgi.test
>>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>>> Created for bundle 42
>>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>>> bundle osgi.test in state Created
>>>
>>>
>>
>>
>
>
>

Re: 'Command not found' when using Equinox

Posted by Stefan Eder <st...@ebuconnect.de>.
   Hi Jean-Baptiste,

Thank you.
The default-activation attribute was not explicitly set, so implicitly 
it should have been eager.
I tried it with both values: same result.
JDK 1.5 or 1.6 makes no difference.

I made org.apache.karaf/karaf/2.2.1 the parent POM of the hello world 
command POM (didn't help).
This is the reason for the Apache stuff appearing in the manifest:
Manifest-Version: 1.0
Export-Package: com.isd.jm.karaf.cmd;uses:="org.apache.karaf.shell.con
  sole,org.apache.felix.gogo.commands"
Built-By: Stefan
Tool: Bnd-1.15.0
Bundle-Name: Unnamed - org.apache.karaf:osgi.test:bundle:2.2.1
Created-By: Apache Maven Bundle Plugin
Bundle-Vendor: The Apache Software Foundation
Build-Jdk: 1.6.0_22
Bundle-Version: 2.2.1
Bnd-LastModified: 1305363687364
Bundle-ManifestVersion: 2
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Description: The Apache Software Foundation provides support fo
  r the Apache community of open-source software projects.    The Apach
  e projects are characterized by a collaborative, consensus based deve
  lopment process, an open and    pragmatic software license, and a des
  ire to create high quality software that leads the way in its field.
     We consider ourselves not simply a group of projects sharing a ser
  ver, but rather a community of developers    and users.
Bundle-SymbolicName: osgi.test
Bundle-DocURL: http://www.apache.org/
Import-Package: org.apache.felix.gogo.commands;version="[0.6,1)",org.a
  pache.karaf.shell.console;version="[2.2,3)",org.osgi.service.blueprin
  t;version="[1.0.0,2.0.0)"

Blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
default-activation="eager">
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
<command name="hello/world">
<action class="com.isd.jm.karaf.cmd.HelloWorldCmd"/>
</command>
</command-bundle>
</blueprint>

Java:
package com.isd.jm.karaf.cmd;

import org.apache.felix.gogo.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;

@Command(scope = "hello", name = "world")
public class HelloWorldCmd extends OsgiCommandSupport
{
     @Override
     protected Object doExecute() throws Exception
     {
         System.out.println("Hello World!");
         return null;
     }
}

POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.karaf</groupId>
<artifactId>karaf</artifactId>
<version>2.2.1</version>
</parent>
<artifactId>osgi.test</artifactId>
<packaging>bundle</packaging>

<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
                             com.isd.jm.karaf.cmd
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
</dependency>
</dependencies>
</project>

It is somehow weired, it is such a basic thing and the core Karaf 
commands work fine with Equinox...

Regards, Stefan

Am 14.05.2011 07:41, schrieb Jean-Baptiste Onofré:
> Hi Stefan,
>
> in the OSGI-INF/blueprint/*.xml of your command, what's your 
> default-activation (eager or lazy) ?
>
> Could you try to use eager in place of lazy ?
> Could you paste your MANIFEST also to see the OSGi package statements ?
>
> Thanks
> Regards
> JB
>
> On 05/14/2011 01:56 AM, Stefan Eder wrote:
>> Hi,
>>
>> I have a problem extending the console with own commands, when I run
>> Karaf with Equinox.
>>
>> To check this problem again, I installed a simple "Hello World" command
>> with blueprint and minimal dependencies on Karaf/Felix and on
>> Karaf/Equinox, both in a virgin state (deleted data directory).
>>
>> With Karaf/Felix the command is executed, with Karaf/Equinox it is not
>> executed. Instead I get the error message "Command not found: 
>> hello:world".
>>
>> I am running the latest release 2.2.1, build on my system, but I have
>> also reproduced the problem with the 2.2.0 binary distribution.
>>
>> The following log outputs appears only with Karaf/Felix:
>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>> org.apache.karaf.shell.console [22] and service registration
>> org.apache.felix.framework.ServiceRegistrationImpl@5cd5a2a9
>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>> org.apache.aries.blueprint - 0.3.0 | Service created:
>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>> service registration
>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-181
>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>> blueprintBundleContext
>>
>> Up to this point the log output is equal with both frameworks (see 
>> below).
>>
>> What might be the problem?
>>
>> Stefan
>>
>> osgi.test - 0.0.1 | BundleEvent INSTALLED
>> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
>> org.apache.karaf.shell.console_2.2.0 [22] and service registration
>> {org.apache.karaf.shell.console.CompletableFunction,
>> org.apache.felix.service.command.Function}={osgi.command.function=start,
>> osgi.command.scope=osgi, service.id=152}
>> org.apache.aries.blueprint - 0.3.0 | Creating service instance
>> org.apache.aries.blueprint - 0.3.0 | Service created:
>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>> org.apache.aries.blueprint - 0.3.0 | Creating listeners
>> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
>> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
>> service registration
>> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
>> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
>> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-135
>> org.apache.aries.blueprint - 0.3.0 | Instantiating component
>> blueprintBundleContext
>> org.apache.aries.blueprint - 0.3.0 | Scanning bundle osgi.test for
>> blueprint application
>> osgi.test - 0.0.1 | BundleEvent RESOLVED
>> org.apache.aries.blueprint - 0.3.0 | Found blueprint application in
>> bundle osgi.test with paths:
>> [bundleentry://42.fwk572511714/OSGI-INF/blueprint/commands.xml]
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state Unknown
>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>> BlueprintEvent[type=CREATING] for bundle osgi.test
>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>> Creating for bundle 42
>> osgi.test - 0.0.1 | BundleEvent STARTED
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state WaitForNamespaceHandlers
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state Populated
>> org.apache.aries.blueprint - 0.3.0 | Tracking service references: []
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state WaitForInitialReferences
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state InitialReferencesSatisfied
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state WaitForInitialReferences2
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state Create
>> org.apache.aries.blueprint - 0.3.0 | Registering service shell-182 with
>> interfaces [org.apache.karaf.shell.console.CompletableFunction,
>> org.apache.felix.service.command.Function] and properties
>> {osgi.command.function=world, osgi.command.scope=hello}
>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>> org.apache.aries.blueprint - 0.3.0 | Instantiating components:
>> [blueprintContainer, blueprintBundle, blueprintBundleContext,
>> blueprintConverter]
>> osgi.test - 0.0.1 | ServiceEvent REGISTERED
>> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
>> BlueprintEvent[type=CREATED] for bundle osgi.test
>> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
>> Created for bundle 42
>> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
>> bundle osgi.test in state Created
>>
>>
>
>



Re: 'Command not found' when using Equinox

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Stefan,

in the OSGI-INF/blueprint/*.xml of your command, what's your 
default-activation (eager or lazy) ?

Could you try to use eager in place of lazy ?
Could you paste your MANIFEST also to see the OSGi package statements ?

Thanks
Regards
JB

On 05/14/2011 01:56 AM, Stefan Eder wrote:
> Hi,
>
> I have a problem extending the console with own commands, when I run
> Karaf with Equinox.
>
> To check this problem again, I installed a simple "Hello World" command
> with blueprint and minimal dependencies on Karaf/Felix and on
> Karaf/Equinox, both in a virgin state (deleted data directory).
>
> With Karaf/Felix the command is executed, with Karaf/Equinox it is not
> executed. Instead I get the error message "Command not found: hello:world".
>
> I am running the latest release 2.2.1, build on my system, but I have
> also reproduced the problem with the 2.2.0 binary distribution.
>
> The following log outputs appears only with Karaf/Felix:
> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
> org.apache.karaf.shell.console [22] and service registration
> org.apache.felix.framework.ServiceRegistrationImpl@5cd5a2a9
> org.apache.aries.blueprint - 0.3.0 | Creating service instance
> org.apache.aries.blueprint - 0.3.0 | Service created:
> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
> org.apache.aries.blueprint - 0.3.0 | Creating listeners
> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
> service registration
> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
> org.apache.karaf.shell.console.commands.BlueprintCommand@34bdb859
> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-181
> org.apache.aries.blueprint - 0.3.0 | Instantiating component
> blueprintBundleContext
>
> Up to this point the log output is equal with both frameworks (see below).
>
> What might be the problem?
>
> Stefan
>
> osgi.test - 0.0.1 | BundleEvent INSTALLED
> org.apache.aries.blueprint - 0.3.0 | Retrieving service for bundle
> org.apache.karaf.shell.console_2.2.0 [22] and service registration
> {org.apache.karaf.shell.console.CompletableFunction,
> org.apache.felix.service.command.Function}={osgi.command.function=start,
> osgi.command.scope=osgi, service.id=152}
> org.apache.aries.blueprint - 0.3.0 | Creating service instance
> org.apache.aries.blueprint - 0.3.0 | Service created:
> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
> org.apache.aries.blueprint - 0.3.0 | Creating listeners
> org.apache.aries.blueprint - 0.3.0 | Listeners created: []
> org.apache.aries.blueprint - 0.3.0 | Calling listeners for initial
> service registration
> org.apache.aries.blueprint - 0.3.0 | Method entry: getService, args
> org.apache.karaf.shell.console.commands.BlueprintCommand@1648ff68
> org.apache.aries.blueprint - 0.3.0 | Instantiating component shell-135
> org.apache.aries.blueprint - 0.3.0 | Instantiating component
> blueprintBundleContext
> org.apache.aries.blueprint - 0.3.0 | Scanning bundle osgi.test for
> blueprint application
> osgi.test - 0.0.1 | BundleEvent RESOLVED
> org.apache.aries.blueprint - 0.3.0 | Found blueprint application in
> bundle osgi.test with paths:
> [bundleentry://42.fwk572511714/OSGI-INF/blueprint/commands.xml]
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state Unknown
> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
> BlueprintEvent[type=CREATING] for bundle osgi.test
> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
> Creating for bundle 42
> osgi.test - 0.0.1 | BundleEvent STARTED
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state WaitForNamespaceHandlers
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state Populated
> org.apache.aries.blueprint - 0.3.0 | Tracking service references: []
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state WaitForInitialReferences
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state InitialReferencesSatisfied
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state WaitForInitialReferences2
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state Create
> org.apache.aries.blueprint - 0.3.0 | Registering service shell-182 with
> interfaces [org.apache.karaf.shell.console.CompletableFunction,
> org.apache.felix.service.command.Function] and properties
> {osgi.command.function=world, osgi.command.scope=hello}
> osgi.test - 0.0.1 | ServiceEvent REGISTERED
> org.apache.aries.blueprint - 0.3.0 | Instantiating components:
> [blueprintContainer, blueprintBundle, blueprintBundleContext,
> blueprintConverter]
> osgi.test - 0.0.1 | ServiceEvent REGISTERED
> org.apache.aries.blueprint - 0.3.0 | Sending blueprint container event
> BlueprintEvent[type=CREATED] for bundle osgi.test
> org.apache.karaf.shell.osgi - 2.2.0 | Blueprint app state changed to
> Created for bundle 42
> org.apache.aries.blueprint - 0.3.0 | Running blueprint container for
> bundle osgi.test in state Created
>
>