You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Erik Brakkee <er...@gmail.com> on 2019/04/11 15:19:36 UTC

Creating custom command in Karaf

Hi,

I wanted to add a new command to apache karaf to be able to troubleshoot
some more in detail in to the dependencies. I use the bundles command from
the karaf source as input/inspiration.

Nevertheless, I am getting undeterministic behavior. Sometimes the command
(acme:deps) works, but other times, both the existing bundle command and
the new acme commands stop working. At other times, it works again so the
behavior is undeterministic.  I don't know how to troubleshoot this
further. Do you have any tips?

Environment:

   1. karaf 4.2.4, with the following features installed: http,
   http-whiteboard, war, jndi, transaction, jdbc, webconsole,
   pax-jdbc-pool-dbcp2, jms, eclipselink, paxx-cdi-openwebbeans
   2. centos 7, 64 bit, Linux whistler 3.10.0-862.3.2.el7.x86_64 #1 SMP Mon
   May 21 23:36:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
   3. jdk 1.8.0_131, Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11,
   mixed mode)

The source files are attached. below:

   1. pom.xml
   2. Hello.java: a dummy command
   3. RevTreeShow.java: the command that I am interested in
   4. acme.tar.gz: an archive with the above files in the correct directory
   structure.

Cheers
  Erik

PS. output of   feature:list -i is:

karaf@root()> feature:list -i
Name                         â Version          â Required â State   â
Repository               â Description
ââââââââââââââââââââââââââââââ¼âââââââââââââââââââ¼âââââââââââ¼ââââââââââ¼âââââââââââââââââââââââââââ¼ââââââââââââââââââââââââââââââââââââââââââââââââââ
aries-proxy                  â 4.2.4            â          â Started â
standard-4.2.4           â Aries Proxy
feature                      â 4.2.4            â          â Started â
standard-4.2.4           â Features Support
shell                        â 4.2.4            â          â Started â
standard-4.2.4           â Karaf Shell
deployer                     â 4.2.4            â          â Started â
standard-4.2.4           â Karaf Deployer
bundle                       â 4.2.4            â          â Started â
standard-4.2.4           â Provide Bundle support
config                       â 4.2.4            â          â Started â
standard-4.2.4           â Provide OSGi ConfigAdmin support
diagnostic                   â 4.2.4            â          â Started â
standard-4.2.4           â Provide Diagnostic support
instance                     â 4.2.4            â          â Started â
standard-4.2.4           â Provide Instance support
jaas                         â 4.2.4            â          â Started â
standard-4.2.4           â Provide JAAS support
log                          â 4.2.4            â          â Started â
standard-4.2.4           â Provide Log support
package                      â 4.2.4            â          â Started â
standard-4.2.4           â Package commands and mbeans
service                      â 4.2.4            â          â Started â
standard-4.2.4           â Provide Service support
system                       â 4.2.4            â          â Started â
standard-4.2.4           â Provide System support
http                         â 4.2.4            â x        â Started â
standard-4.2.4           â Implementation of the OSGI HTTP Service
pax-http-service             â 7.2.8            â          â Started â
standard-4.2.4           â Pax-Web OSGi HTTP Service
http-whiteboard              â 4.2.4            â x        â Started â
standard-4.2.4           â Provide HTTP Whiteboard pattern support
war                          â 4.2.4            â x        â Started â
standard-4.2.4           â Turn Karaf as a full WebContainer
kar                          â 4.2.4            â          â Started â
standard-4.2.4           â Provide KAR (KARaf archive) support
webconsole                   â 4.2.4            â x        â Started â
standard-4.2.4           â Base support of the Karaf WebConsole
ssh                          â 4.2.4            â          â Started â
standard-4.2.4           â Provide a SSHd server on Karaf
management                   â 4.2.4            â          â Started â
standard-4.2.4           â Provide a JMX MBeanServer and a set of MBeans in
scr                          â 4.2.4            â          â Started â
standard-4.2.4           â Declarative Service support
minimal                      â 4.2.4            â x        â Started â
standard-4.2.4           â Wrap feature describing all features part of a mi
pax-transx-tm-api            â 0.4.2            â          â Started â
pax-transx-0.4.2         â
pax-transx-tm-geronimo       â 0.4.2            â          â Started â
pax-transx-0.4.2         â
pax-transx-tm                â 0.4.2            â          â Started â
pax-transx-0.4.2         â
pax-transx-connector         â 0.4.2            â          â Started â
pax-transx-0.4.2         â
pax-transx-jms               â 0.4.2            â          â Started â
pax-transx-0.4.2         â
pax-jdbc-spec                â 1.3.4            â          â Started â
org.ops4j.pax.jdbc-1.3.4 â Provides OSGi JDBC Service spec
pax-jdbc                     â 1.3.4            â          â Started â
org.ops4j.pax.jdbc-1.3.4 â Provides JDBC Service support
pax-jdbc-config              â 1.3.4            â          â Started â
org.ops4j.pax.jdbc-1.3.4 â Provides JDBC Config support
pax-jdbc-pool-dbcp2          â 1.3.4            â x        â Started â
org.ops4j.pax.jdbc-1.3.4 â Provides JDBC Pooling DataSourceFactory
pax-cdi                      â 1.1.1            â          â Started â
org.ops4j.pax.cdi-1.1.1  â Provide CDI support
pax-cdi-openwebbeans         â 1.1.1            â x        â Started â
org.ops4j.pax.cdi-1.1.1  â OpenWebBeans CDI support
pax-jms-core                 â 1.0.3            â          â Started â
pax-jms-1.0.3            â
pax-jms-config               â 1.0.3            â          â Started â
pax-jms-1.0.3            â
pax-jms-pool-pooledjms       â 1.0.3            â          â Started â
pax-jms-1.0.3            â
pax-jms-pool-transx          â 1.0.3            â          â Started â
pax-jms-1.0.3            â
pax-jms-pool                 â 1.0.3            â          â Started â
pax-jms-1.0.3            â
jpa                          â 2.7.2            â          â Started â
aries-jpa-2.7.2          â OSGi Persistence Container
pax-web-core                 â 7.2.8            â          â Started â
org.ops4j.pax.web-7.2.8  â Provide Core pax-web bundles
pax-jetty                    â 9.4.12.v20180830 â          â Started â
org.ops4j.pax.web-7.2.8  â Provide Jetty engine support
pax-http-jetty               â 7.2.8            â          â Started â
org.ops4j.pax.web-7.2.8  â
pax-http                     â 7.2.8            â          â Started â
org.ops4j.pax.web-7.2.8  â Implementation of the OSGI HTTP Service
pax-http-whiteboard          â 7.2.8            â          â Started â
org.ops4j.pax.web-7.2.8  â Provide HTTP Whiteboard pattern support
pax-war                      â 7.2.8            â          â Started â
org.ops4j.pax.web-7.2.8  â Provide support of a full WebContainer
transaction-api              â 1.2.0            â          â Started â
enterprise-4.2.4         â
transaction-manager-geronimo â 3.1.3            â          â Started â
enterprise-4.2.4         â Geronimo Transaction Manager
transaction                  â 2.0.0            â x        â Started â
enterprise-4.2.4         â OSGi Transaction Manager
eclipselink                  â 2.7.4            â x        â Started â
enterprise-4.2.4         â Eclipselink JPA persistence engine support
jndi                         â 4.2.4            â x        â Started â
enterprise-4.2.4         â OSGi Service Registry JNDI access
jdbc                         â 4.2.4            â x        â Started â
enterprise-4.2.4         â JDBC service and commands
jms                          â 4.2.4            â x        â Started â
enterprise-4.2.4         â JMS service and commands

Re: Creating custom command in Karaf

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

How do you install/start your command ? Via a feature ?

Anything in the log ?

Regards
JB

On 11/04/2019 17:19, Erik Brakkee wrote:
> Hi, 
> 
> I wanted to add a new command to apache karaf to be able to troubleshoot
> some more in detail in to the dependencies. I use the bundles command
> from the karaf source as input/inspiration. 
> 
> Nevertheless, I am getting undeterministic behavior. Sometimes the
> command (acme:deps) works, but other times, both the existing bundle
> command and the new acme commands stop working. At other times, it works
> again so the behavior is undeterministic.  I don't know how to
> troubleshoot this further. Do you have any tips?
> 
> Environment:
> 
>  1. karaf 4.2.4, with the following features installed: http,
>     http-whiteboard, war, jndi, transaction, jdbc, webconsole,
>     pax-jdbc-pool-dbcp2, jms, eclipselink, paxx-cdi-openwebbeans
>  2. centos 7, 64 bit, Linux whistler 3.10.0-862.3.2.el7.x86_64 #1 SMP
>     Mon May 21 23:36:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
>  3. jdk 1.8.0_131, Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11,
>     mixed mode)
> 
> The source files are attached. below: 
> 
>  1. pom.xml
>  2. Hello.java: a dummy command
>  3. RevTreeShow.java: the command that I am interested in
>  4. acme.tar.gz: an archive with the above files in the correct
>     directory structure.
> 
> Cheers
>   Erik
> 
> PS. output of   feature:list -i is: 
> 
> karaf@root()> feature:list -i 
> Name                         â Version          â Required â State   â
> Repository               â Description
> ââââââââââââââââââââââââââââââ¼âââââââââââââââââââ¼âââââââââââ¼ââââââââââ¼âââââââââââââââââââââââââââ¼ââââââââââââââââââââââââââââââââââââââââââââââââââ
> aries-proxy                  â 4.2.4            â          â Started â
> standard-4.2.4           â Aries Proxy
> feature                      â 4.2.4            â          â Started â
> standard-4.2.4           â Features Support
> shell                        â 4.2.4            â          â Started â
> standard-4.2.4           â Karaf Shell
> deployer                     â 4.2.4            â          â Started â
> standard-4.2.4           â Karaf Deployer
> bundle                       â 4.2.4            â          â Started â
> standard-4.2.4           â Provide Bundle support
> config                       â 4.2.4            â          â Started â
> standard-4.2.4           â Provide OSGi ConfigAdmin support
> diagnostic                   â 4.2.4            â          â Started â
> standard-4.2.4           â Provide Diagnostic support
> instance                     â 4.2.4            â          â Started â
> standard-4.2.4           â Provide Instance support
> jaas                         â 4.2.4            â          â Started â
> standard-4.2.4           â Provide JAAS support
> log                          â 4.2.4            â          â Started â
> standard-4.2.4           â Provide Log support
> package                      â 4.2.4            â          â Started â
> standard-4.2.4           â Package commands and mbeans
> service                      â 4.2.4            â          â Started â
> standard-4.2.4           â Provide Service support
> system                       â 4.2.4            â          â Started â
> standard-4.2.4           â Provide System support
> http                         â 4.2.4            â x        â Started â
> standard-4.2.4           â Implementation of the OSGI HTTP Service
> pax-http-service             â 7.2.8            â          â Started â
> standard-4.2.4           â Pax-Web OSGi HTTP Service
> http-whiteboard              â 4.2.4            â x        â Started â
> standard-4.2.4           â Provide HTTP Whiteboard pattern support
> war                          â 4.2.4            â x        â Started â
> standard-4.2.4           â Turn Karaf as a full WebContainer
> kar                          â 4.2.4            â          â Started â
> standard-4.2.4           â Provide KAR (KARaf archive) support
> webconsole                   â 4.2.4            â x        â Started â
> standard-4.2.4           â Base support of the Karaf WebConsole
> ssh                          â 4.2.4            â          â Started â
> standard-4.2.4           â Provide a SSHd server on Karaf
> management                   â 4.2.4            â          â Started â
> standard-4.2.4           â Provide a JMX MBeanServer and a set of MBeans in
> scr                          â 4.2.4            â          â Started â
> standard-4.2.4           â Declarative Service support
> minimal                      â 4.2.4            â x        â Started â
> standard-4.2.4           â Wrap feature describing all features part of a mi
> pax-transx-tm-api            â 0.4.2            â          â Started â
> pax-transx-0.4.2         â
> pax-transx-tm-geronimo       â 0.4.2            â          â Started â
> pax-transx-0.4.2         â
> pax-transx-tm                â 0.4.2            â          â Started â
> pax-transx-0.4.2         â
> pax-transx-connector         â 0.4.2            â          â Started â
> pax-transx-0.4.2         â
> pax-transx-jms               â 0.4.2            â          â Started â
> pax-transx-0.4.2         â
> pax-jdbc-spec                â 1.3.4            â          â Started â
> org.ops4j.pax.jdbc-1.3.4 â Provides OSGi JDBC Service spec
> pax-jdbc                     â 1.3.4            â          â Started â
> org.ops4j.pax.jdbc-1.3.4 â Provides JDBC Service support
> pax-jdbc-config              â 1.3.4            â          â Started â
> org.ops4j.pax.jdbc-1.3.4 â Provides JDBC Config support
> pax-jdbc-pool-dbcp2          â 1.3.4            â x        â Started â
> org.ops4j.pax.jdbc-1.3.4 â Provides JDBC Pooling DataSourceFactory
> pax-cdi                      â 1.1.1            â          â Started â
> org.ops4j.pax.cdi-1.1.1  â Provide CDI support
> pax-cdi-openwebbeans         â 1.1.1            â x        â Started â
> org.ops4j.pax.cdi-1.1.1  â OpenWebBeans CDI support
> pax-jms-core                 â 1.0.3            â          â Started â
> pax-jms-1.0.3            â
> pax-jms-config               â 1.0.3            â          â Started â
> pax-jms-1.0.3            â
> pax-jms-pool-pooledjms       â 1.0.3            â          â Started â
> pax-jms-1.0.3            â
> pax-jms-pool-transx          â 1.0.3            â          â Started â
> pax-jms-1.0.3            â
> pax-jms-pool                 â 1.0.3            â          â Started â
> pax-jms-1.0.3            â
> jpa                          â 2.7.2            â          â Started â
> aries-jpa-2.7.2          â OSGi Persistence Container
> pax-web-core                 â 7.2.8            â          â Started â
> org.ops4j.pax.web-7.2.8  â Provide Core pax-web bundles
> pax-jetty                    â 9.4.12.v20180830 â          â Started â
> org.ops4j.pax.web-7.2.8  â Provide Jetty engine support
> pax-http-jetty               â 7.2.8            â          â Started â
> org.ops4j.pax.web-7.2.8  â
> pax-http                     â 7.2.8            â          â Started â
> org.ops4j.pax.web-7.2.8  â Implementation of the OSGI HTTP Service
> pax-http-whiteboard          â 7.2.8            â          â Started â
> org.ops4j.pax.web-7.2.8  â Provide HTTP Whiteboard pattern support
> pax-war                      â 7.2.8            â          â Started â
> org.ops4j.pax.web-7.2.8  â Provide support of a full WebContainer
> transaction-api              â 1.2.0            â          â Started â
> enterprise-4.2.4         â
> transaction-manager-geronimo â 3.1.3            â          â Started â
> enterprise-4.2.4         â Geronimo Transaction Manager
> transaction                  â 2.0.0            â x        â Started â
> enterprise-4.2.4         â OSGi Transaction Manager
> eclipselink                  â 2.7.4            â x        â Started â
> enterprise-4.2.4         â Eclipselink JPA persistence engine support
> jndi                         â 4.2.4            â x        â Started â
> enterprise-4.2.4         â OSGi Service Registry JNDI access
> jdbc                         â 4.2.4            â x        â Started â
> enterprise-4.2.4         â JDBC service and commands
> jms                          â 4.2.4            â x        â Started â
> enterprise-4.2.4         â JMS service and commands
> 
> 

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