karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@quarendon.net
Subject Re: Creating a karaf feature containing a karaf shell command breaks karaf
Date Thu, 07 Sep 2017 08:22:09 GMT
There's a complete example here:
https://github.com/tomq42/karaf-command-feature

Thanks.

> On 07 September 2017 at 09:15 Jean-Baptiste Onofré <jb@nanthrax.net> wrote:
> 
> 
> Hi Tom,
> 
> can you share the pom.xml you use to create your custom distro ?
> 
> It looks like some resources are missing in the distro.
> 
> Regards
> JB
> 
> On 09/07/2017 10:06 AM, tom@quarendon.net wrote:
> > Clearly this can't be true, since karaf ships with features containing bundles containing
commands, but I can't get it to work.
> > 
> > I've created a simple karaf shell command, following the tutorial in the documentation.
As per the example, it just says "hello world".
> > If I build that as an isolated bundle, install it into karaf and run it, it works,
as per the documentation.
> > 
> > What I'm trying to do though is build that into a feature to include into a custom
karaf distribution.
> > I can build the feature, and I can manually install the feature into a karaf distribution,
and it works OK, I can run the resulting command.
> > I can build the karaf distribution containing the feature OK, but when I then run
the resulting karaf then fails to initialise properly.
> > 
> > 
> > In the log file, I get:
> > Adding features:
> > Changes to perform:
> > Region: root
> > Bundles to install:
> > ...
> > mvn:org.apache.karaf.shell/org.apache.karaf.shell.console/4.1.2
> > null <-- This is clearly bad
> > mvn:org.apache.karaf.shell/org.apache.karaf.shell.ssh/4.1.2
> > ...
> > 
> > Installing bundles:
> > ...
> > null <-- This is the same null as before and causes the problem below.
> > Error installing boot features
> > java.lang.IllegalStateException: Resource has no uri
> > 	at org.apache.karaf.features.internal.service.Deployer.getBundleInputStream(Deployer.java:1460)
[10:org.apache.karaf.features.core:4.1.2]
> > 	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:766)
[10:org.apache.karaf.features.core:4.1.2]
> > 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1233)
[10:org.apache.karaf.features.core:4.1.2]
> > 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$0(FeaturesServiceImpl.java:1132)
[10:org.apache.karaf.features.core:4.1.2]
> > 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl$$Lambda$15/951619949.call(Unknown
Source) [10:org.apache.karaf.features.core:4.1.2]
> > 	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
> > 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[?:?]
> > 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?]
> > 
> > The console then goes funny, and you get:
> > Error in initialization script: etc\shell.init.script: String index out of range:
0
> > which I'm assuming is a knockon issue.
> > 
> > I've got no idea where this "null" bundle is coming from, but it's clearly causing
the karaf initialisation to go wrong.
> > 
> > I have created an example project at https://github.com/tomq42/karaf-command-feature
which I hope shows the problem.
> > Just build with maven, then run the karaf-distro\target\assembly\bin\karaf(.bat)
command. You should see the error above on the console, and the error in the log.
> > 
> > Any insight would be very welcome.
> > Thanks.
> > 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Mime
View raw message