You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Relational and Re-engineering <st...@gmail.com> on 2013/07/26 16:28:17 UTC

Karaf blueprint "Failure" while extending console

I am using Karaf 2.3.1. I was following Apache Karaf Manual exercise
"Extending the console" page no. 105. I followed all the instruction ditto,
with a few deviations. I am able to load the bundle HelloShellCommand into
Karaf. It threw me a bundle Id. But the command "test.hello" is not working.

karaf@root> osgi:classes is showing
org/apache/karaf.shell/samplesHelloShellCommand.class

karaf@root> test.hello is showing command not found

karaf@root> osgi:list is showing Blueprint "Failure" for the given bundle.
State is Active.

I did deviate from the given instruction in "Compiling the JAR" section in
following steps:

Let's try to build the jar: I did build the jar from Eclipse.
File-Export-Java-Jar File.

Then run "mvn install": This is where I did not understand how Maven will
use the .jar file. It is looking for pom.xml. So, I went into root directory
and ran "mvn install". It went through successfully.

osgi:install -s
mvn:org.apache.karaf.shell.samples/shell-sample-commands/1.0-SNAPSHOT also
went through successfully. But I suspect Blueprint.xml did not go through.

I need help in:

1. How to resolve this?

2. How to know in Karaf what commands test.hello is installed with each
bundle? I want to know which osgi command will tell me about user defined
commands installed with bundle. I mean to know the capability of bundle I
need this command. I did issue osgi:info and osgi:classes but it did not
tell me about commands inside the bundles. 

3. .jar file created in step-1 is different from "mvn install" which uses
pom.xml. Is there something I am missing? How to make mvn use the .jar?

4. And why blueprint.xml did not load?

Thanks in advance



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by SapnaB <sa...@gmail.com>.
Hi All,

Thanks for all the suggestions. I could now execute the bundle.

I uninstalled the existing erroneous bundle and installed again. That did
away with the incorrect dependency on
org.apache.*felix*.karaf.shell.console.

Regards,
Sapna





 



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033379.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
You use the 2.2.x manual with 2.1.x karaf bundle.

Upgrade to 2.3.x and it should work.

Regards
JB

On 06/02/2014 08:26 AM, SapnaB wrote:
> Hi JB,
>
> I used maven 3.2.1 (mvn archetype:create) to create the command bundle.
> Im usign Karaf 2.3.2 and the manual Im referring to is :
>
> http://karaf.apache.org/manual/latest-2.2.x/developers-guide/extending-console.html
>
> The maven dependency to karaf shell console is as below:
> <dependency>
>        <groupId>org.apache.karaf.shell</groupId>
>        <artifactId>org.apache.karaf.shell.console</artifactId>
>        <version>2.2.11</version>
>      </dependency>
>
> I guess I need to find out where the dependency to
> org.apache.*felix*.karaf.shell.console is coming from.
>
> Regards,
> Sapna
>
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033377.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

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

Re: Karaf blueprint "Failure" while extending console

Posted by SapnaB <sa...@gmail.com>.
Hi JB,

I used maven 3.2.1 (mvn archetype:create) to create the command bundle.
Im usign Karaf 2.3.2 and the manual Im referring to is :

http://karaf.apache.org/manual/latest-2.2.x/developers-guide/extending-console.html

The maven dependency to karaf shell console is as below:
<dependency>
      <groupId>org.apache.karaf.shell</groupId>
      <artifactId>org.apache.karaf.shell.console</artifactId>
      <version>2.2.11</version>
    </dependency>

I guess I need to find out where the dependency to
org.apache.*felix*.karaf.shell.console is coming from.

Regards,
Sapna






--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033377.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

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

the shell-sample-commands bundle seems very old (or not correct) as it 
reference the package org.apache.felix.karaf.shell.console in version 
1.4.0 and 2.0.0.

I would advice to take a look on the dev guide:
http://karaf.apache.org/manual/latest-2.3.x/developers-guide/extending-console.html 
for Karaf 2.3.x
http://karaf.apache.org/manual/latest/developers-guide/extending.html 
for Karaf 3.0.x

in the "manual creation" section.

I guess that you use the archetype to create the command bundle ? In 
this case, which version ?
I will take a look if the archetype is up to date.

As I said to another user yesterday, I also advice to take a look in the 
OSGi spec to understand what is wiring/package resolution and help to 
diagnostic this kind of exception.

Regards
JB

On 06/02/2014 08:01 AM, SapnaB wrote:
> Hi,
>
> I did use the maven-bundle-plugin to bundle the plugin and have the relevant
> manifest now.
> The build is successful, but when I try and start the bundle in karaf, I get
> the following exception:
>
> ERROR: Bundle org.apache.karaf.shell.samples.shell-sample-commands [98]
> Error starting
> mvn:org.apache.karaf.shell.samples/shell-sample-commands/1.0-SNAPSHOT
> (org.osgi.framework.BundleException: Unresolved constraint in bundle
> org.apache.karaf.shell.samples.shell-sample-commands [98]: Unable to resolve
> 98.0: missing requirement [98.0] osgi.wiring.package;
> (&(osgi.wiring.package=org.apache.felix.karaf.shell.console)(version>=1.4.0)(!(version>=2.0.0))))
> org.osgi.framework.BundleException: Unresolved constraint in bundle
> org.apache.karaf.shell.samples.shell-sample-commands [98]: Unable to resolve
> 98.0: missing requirement [98.0] osgi.wiring.package;
> (&(osgi.wiring.package=org.apache.felix.karaf.shell.console)(version>=1.4.0)(!(version>=2.0.0)))
>          at
> org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)
>          at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
>          at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
>          at
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
>          at java.lang.Thread.run(Thread.java:722)
>
> Any pointers on how I can get rid of this exception and run the bundle
> successfully?
>
> Thanks in advance,
> Sapna
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033375.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

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

Re: Karaf blueprint "Failure" while extending console

Posted by SapnaB <sa...@gmail.com>.
Hi,

I did use the maven-bundle-plugin to bundle the plugin and have the relevant
manifest now.
The build is successful, but when I try and start the bundle in karaf, I get
the following exception:

ERROR: Bundle org.apache.karaf.shell.samples.shell-sample-commands [98]
Error starting
mvn:org.apache.karaf.shell.samples/shell-sample-commands/1.0-SNAPSHOT
(org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.karaf.shell.samples.shell-sample-commands [98]: Unable to resolve
98.0: missing requirement [98.0] osgi.wiring.package;
(&(osgi.wiring.package=org.apache.felix.karaf.shell.console)(version>=1.4.0)(!(version>=2.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.karaf.shell.samples.shell-sample-commands [98]: Unable to resolve
98.0: missing requirement [98.0] osgi.wiring.package;
(&(osgi.wiring.package=org.apache.felix.karaf.shell.console)(version>=1.4.0)(!(version>=2.0.0)))
        at
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
        at
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
        at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
        at java.lang.Thread.run(Thread.java:722)

Any pointers on how I can get rid of this exception and run the bundle
successfully?

Thanks in advance,
Sapna




--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033375.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

yes make sure you use the maven-bundle-plugin from the felix project to
create the manifest file.
This will generate all needed manifest headers.
With the default Manifest headers your bundle is just a jar and no OSGi
bundle :)

regards, Achim


2014-05-30 9:22 GMT+02:00 SapnaB <sa...@gmail.com>:

> Hi Krzysztof,
>
> i created the bundle project using mvn archetype, and then generated an
> eclipse project from maven using mvn eclipse:eclipse.
> The project was bundled using mvn install.
>
> I the jar, I do see a manifest.mf with the following entries:
> Manifest-Version: 1.0
> Archiver-Version: Plexus Archiver
> Created-By: Apache Maven
> Built-By: sapbharg
> Build-Jdk: 1.7.0_25
>
> The version, artifact-id, groupId etc are configured in the pom.xml.
>
> Do i need to specifically create a manifest file with all this data?
>
> Thanks,
> Sapna
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033342.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Re: Karaf blueprint "Failure" while extending console

Posted by SapnaB <sa...@gmail.com>.
Hi Krzysztof,

i created the bundle project using mvn archetype, and then generated an
eclipse project from maven using mvn eclipse:eclipse. 
The project was bundled using mvn install.

I the jar, I do see a manifest.mf with the following entries:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: sapbharg
Build-Jdk: 1.7.0_25

The version, artifact-id, groupId etc are configured in the pom.xml.

Do i need to specifically create a manifest file with all this data?

Thanks,
Sapna




--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033342.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by "Sobkowiak, Krzysztof" <kr...@gmail.com>.
Hi Sapna

Does your bundle contain OSGi manifest data (version, symbolic name, etc)?

Best regards
Krzysztof


On 30.05.2014 09:00, SapnaB wrote:
> Hi All,
>
>
> In continuation with the above post, in the log files, I see 
>
> 2014-05-29 23:15:04,448 | ERROR | l Console Thread | BlueprintContainerImpl          
> | container.BlueprintContainerImpl  393 | 7 -
> org.apache.aries.blueprint.core - 1.1.0 | *Unable to start blueprint
> container for bundle null*
>
> Why is the bundle name null? Is there some configuration required in the
> blueprint.xml file to provide an id to the bundle?
>
> Any help will be greatly appreciated.
>
> Thanks,
> Sapna
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033340.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.

-- 
Krzysztof Sobkowiak

JEE & OSS Architect | Technical Architect @ Capgemini
Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
<http://www.pl.capgemini-sdm.com/> | Wroclaw
e-mail: krzys.sobkowiak@gmail.com <ma...@gmail.com> |
Twitter: @KSobkowiak
Calendar: http://goo.gl/yvsebC

Re: Karaf blueprint "Failure" while extending console

Posted by SapnaB <sa...@gmail.com>.
Hi All,


In continuation with the above post, in the log files, I see 

2014-05-29 23:15:04,448 | ERROR | l Console Thread | BlueprintContainerImpl          
| container.BlueprintContainerImpl  393 | 7 -
org.apache.aries.blueprint.core - 1.1.0 | *Unable to start blueprint
container for bundle null*

Why is the bundle name null? Is there some configuration required in the
blueprint.xml file to provide an id to the bundle?

Any help will be greatly appreciated.

Thanks,
Sapna



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033340.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by SapnaB <sa...@gmail.com>.
Hi All,

Im using Karaf 2.3.2 and face the same issue (test:hello Command not found) 
while executing the sample console extension project on the Karaf Manual:
http://karaf.apache.org/manual/latest-2.2.x/developers-guide/extending-console.html

Is there resolution for this problem? 
osgi:list shows:
[  94] [Active     ] [Failure     ] [       ] [   80]
mvn:org.apache.karaf.shell.samples/shell-sample-commands/1.0-SNAPSHOT

Log file shows the follwoing stackTrace:

2014-05-29 23:15:04,448 | ERROR | l Console Thread | BlueprintContainerImpl          
| container.BlueprintContainerImpl  393 | 7 -
org.apache.aries.blueprint.core - 1.1.0 | Unable to start blueprint
container for bundle null
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:604)[:1.7.0_11]
	at java.util.ArrayList.get(ArrayList.java:382)[:1.7.0_11]
	at
org.apache.aries.blueprint.container.BlueprintContainerImpl.readDirectives(BlueprintContainerImpl.java:211)[7:org.apache.aries.blueprint.core:1.1.0]
	at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:283)[7:org.apache.aries.blueprint.core:1.1.0]
	at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]

Does anyone has an idea to this problem?




--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4033339.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by Relational and Re-engineering <st...@gmail.com>.
Yeah. I tried. Same story.



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4029390.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by Achim Nierbeck <bc...@googlemail.com>.
Could you give it a try with version 1.1.0 of the Shell XML?

I think this could be a reason.

regards, Achim


2013/7/29 Relational and Re-engineering <st...@gmail.com>

> I did use the following Blueprint file. Could this be a version conflict?
>
> <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>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4029378.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>

Re: Karaf blueprint "Failure" while extending console

Posted by Relational and Re-engineering <st...@gmail.com>.
I did use the following Blueprint file. Could this be a version conflict?

<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>



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4029378.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

Posted by Relational and Re-engineering <st...@gmail.com>.
I would like to add the following log:

2013-07-27 19:44:30,733 | ERROR | rint Extender: 2 | BlueprintContainerImpl          
| container.BlueprintContainerImpl  393 | 7 -
org.apache.aries.blueprint.core - 1.1.0 | Unable to start blueprint
container for bundle null
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:570)[:1.7.0-ea]
	at java.util.ArrayList.get(ArrayList.java:348)[:1.7.0-ea]
	at
org.apache.aries.blueprint.container.BlueprintContainerImpl.readDirectives(BlueprintContainerImpl.java:211)[7:org.apache.aries.blueprint.core:1.1.0]
	at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:283)[7:org.apache.aries.blueprint.core:1.1.0]
	at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
	at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0-ea]
	at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0-ea]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0-ea]
	at
org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
	at
org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
	at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0-ea]
	at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0-ea]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0-ea]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0-ea]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0-ea]
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.7.0-ea]
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.7.0-ea]
	at java.lang.Thread.run(Thread.java:717)[:1.7.0-ea]



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372p4029374.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Re: Karaf blueprint "Failure" while extending console

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

Let me review if the documentation is up to date.

Regards
JB

On 07/26/2013 04:28 PM, Relational and Re-engineering wrote:
> I am using Karaf 2.3.1. I was following Apache Karaf Manual exercise
> "Extending the console" page no. 105. I followed all the instruction ditto,
> with a few deviations. I am able to load the bundle HelloShellCommand into
> Karaf. It threw me a bundle Id. But the command "test.hello" is not working.
>
> karaf@root> osgi:classes is showing
> org/apache/karaf.shell/samplesHelloShellCommand.class
>
> karaf@root> test.hello is showing command not found
>
> karaf@root> osgi:list is showing Blueprint "Failure" for the given bundle.
> State is Active.
>
> I did deviate from the given instruction in "Compiling the JAR" section in
> following steps:
>
> Let's try to build the jar: I did build the jar from Eclipse.
> File-Export-Java-Jar File.
>
> Then run "mvn install": This is where I did not understand how Maven will
> use the .jar file. It is looking for pom.xml. So, I went into root directory
> and ran "mvn install". It went through successfully.
>
> osgi:install -s
> mvn:org.apache.karaf.shell.samples/shell-sample-commands/1.0-SNAPSHOT also
> went through successfully. But I suspect Blueprint.xml did not go through.
>
> I need help in:
>
> 1. How to resolve this?
>
> 2. How to know in Karaf what commands test.hello is installed with each
> bundle? I want to know which osgi command will tell me about user defined
> commands installed with bundle. I mean to know the capability of bundle I
> need this command. I did issue osgi:info and osgi:classes but it did not
> tell me about commands inside the bundles.
>
> 3. .jar file created in step-1 is different from "mvn install" which uses
> pom.xml. Is there something I am missing? How to make mvn use the .jar?
>
> 4. And why blueprint.xml did not load?
>
> Thanks in advance
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-blueprint-Failure-while-extending-console-tp4029372.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

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