Friday, November 6, 2015

Learning basic of apache karaf

Recently container is such a hot topic especially from docker and today, we will look into another container from apache. Today, we will take a look into Apache Karaf.

What is Apache Karaf?

Apache Karaf is a small OSGi based runtime which provides a lightweight container onto which various components and applications can be deployed.

If you have no idea what does that means, maybe a simple quick how to give some idea. First, let's download a copy of apache karaf and you can do that just here. At the time of this learning experience, I'm using Apache Karaf version 4.0.1. Then extract to a path so that will be karaf home directory.

 user@localhost:~/Desktop$ ll apache-karaf-4.0.1.tar.gz   
 -rw-r----- 1 user user 16M Oct 5 22:35 apache-karaf-4.0.1.tar.gz  
 user@localhost:~/Desktop$ tar -zxf apache-karaf-4.0.1.tar.gz   
 user@localhost:~/Desktop$ cd apache-karaf-4.0.1  
 apache-karaf-4.0.1/    apache-karaf-4.0.1.tar.gz   
 user@localhost:~/Desktop$ cd apache-karaf-4.0.1  
 user@localhost:~/Desktop/apache-karaf-4.0.1$ ls  
 bin data demos deploy etc lib LICENSE NOTICE README RELEASE-NOTES system  

So apache is about 16MB compressed and contain a few directories to work with.

The directory layout of a Karaf installation is as follows:
/bin: control scripts to start, stop, login.
/demos: contains some simple Karaf samples
/etc: configuration files
/data: working directory
/cache: OSGi framework bundle cache
/generated-bundles: temporary folder used by the deployers
/log: log files
/deploy: hot deploy directory
/instances: directory containing instances
/lib: contains libraries
/lib/boot: contains the system libraries used at Karaf bootstrap
/lib/endorsed: directory for endorsed libraries
/lib/ext: directory for JRE extensions
/system: OSGi bundles repository, laid out as a Maven 2 repository

Let's launch karaf, see screenshot below in the terminal. Let's add apache camel repository into apache karaf and then install on it. We will therefore using this as a sample for this learning experience.



 karaf@root()> feature:repo-add camel 2.15.3  
 Adding feature url mvn:org.apache.camel.karaf/apache-camel/2.15.3/xml/features  
 karaf@root()> feature:info camel  
 Feature camel 2.15.3  
 Feature has no configuration  
 Feature has no configuration files  
 Feature depends on:  
  camel-core 2.15.3  
  camel-spring 2.15.3  
  camel-blueprint 2.15.3  
 Feature has no bundles.  
 Feature has no conditionals.  
 karaf@root()> feature:install camel-spring  
 karaf@root()> bundle:install -s mvn:org.apache.camel/camel-example-osgi/2.15.3  
 Bundle ID: 82  
 karaf@root()> log:display  
 2015-10-05 22:41:37,872 | INFO | pool-17-thread-1 | core               | 17 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.BundleStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@dd1e765 with name osgi.core:type=bundleState,version=1.7,framework=org.apache.felix.framework,uuid=e7d79bed-237a-4c4d-b912-920b57fef63b  
 2015-10-05 22:41:37,876 | INFO | pool-17-thread-1 | core               | 17 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.service.cm.ConfigurationAdminMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@dd1e765 with name osgi.compendium:service=cm,version=1.3,framework=org.apache.felix.framework,uuid=e7d79bed-237a-4c4d-b912-920b57fef63b  
 2015-10-05 22:41:37,876 | INFO | pool-17-thread-1 | core               | 17 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.wiring.BundleWiringStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@dd1e765 with name osgi.core:type=wiringState,version=1.1,framework=org.apache.felix.framework,uuid=e7d79bed-237a-4c4d-b912-920b57fef63b  
 2015-10-05 22:41:37,877 | INFO | pool-17-thread-1 | core               | 17 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.FrameworkMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@dd1e765 with name osgi.core:type=framework,version=1.7,framework=org.apache.felix.framework,uuid=e7d79bed-237a-4c4d-b912-920b57fef63b  
 2015-10-05 22:41:37,878 | INFO | pool-17-thread-1 | core               | 17 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.PackageStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@dd1e765 with name osgi.core:type=packageState,version=1.5,framework=org.apache.felix.framework,uuid=e7d79bed-237a-4c4d-b912-920b57fef63b  
 2015-10-05 22:41:37,878 | INFO | pool-17-thread-1 | core               | 17 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@dd1e765 with name osgi.core:type=serviceState,version=1.7,framework=org.apache.felix.framework,uuid=e7d79bed-237a-4c4d-b912-920b57fef63b  
 2015-10-05 22:41:38,145 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.bundle.core/4.0.1  
 2015-10-05 22:41:38,168 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.config.core/4.0.1  
 2015-10-05 22:41:38,178 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.deployer.kar/4.0.1  
 2015-10-05 22:41:38,180 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.diagnostic.core/4.0.1  
 2015-10-05 22:41:38,204 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.features.command/4.0.1  
 2015-10-05 22:41:38,230 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.instance.core/4.0.1  
 2015-10-05 22:41:38,256 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.jaas.command/4.0.1  
 2015-10-05 22:41:38,259 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Updating commands for bundle org.apache.karaf.jaas.command/4.0.1  
 2015-10-05 22:41:38,260 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Updating commands for bundle org.apache.karaf.jaas.command/4.0.1  
 2015-10-05 22:41:38,266 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.kar.core/4.0.1  
 2015-10-05 22:41:38,277 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.log.core/4.0.1  
 2015-10-05 22:41:38,281 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.package.core/4.0.1  
 2015-10-05 22:41:38,285 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.service.core/4.0.1  
 2015-10-05 22:41:38,327 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Command registration delayed for bundle org.apache.karaf.shell.commands/4.0.1. Missing dependencies: [org.jledit.EditorFactory]  
 2015-10-05 22:41:38,581 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Command registration delayed for bundle org.apache.karaf.shell.ssh/4.0.1. Missing dependencies: [org.apache.sshd.SshServer]  
 2015-10-05 22:41:38,593 | INFO | pool-23-thread-1 | SecurityUtils          | 47 - org.apache.sshd.core - 0.14.0 | BouncyCastle not registered, using the default JCE provider  
 2015-10-05 22:41:38,624 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.system.core/4.0.1  
 2015-10-05 22:41:38,631 | INFO | FelixStartLevel | CommandExtension         | 43 - org.apache.karaf.shell.core - 4.0.1 | Registering commands for bundle org.apache.karaf.shell.commands/4.0.1  
 2015-10-05 23:18:09,193 | INFO | nsole user karaf | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 | Adding features: camel-spring/[2.15.3,2.15.3]  
 2015-10-05 23:19:30,370 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 | Changes to perform:  
 2015-10-05 23:19:30,371 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  Region: root  
 2015-10-05 23:19:30,371 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |   Bundles to install:  
 2015-10-05 23:19:30,371 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.camel/camel-catalog/2.15.3  
 2015-10-05 23:19:30,371 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.camel/camel-commands-core/2.15.3  
 2015-10-05 23:19:30,372 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.camel/camel-core/2.15.3  
 2015-10-05 23:19:30,372 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.camel/camel-spring/2.15.3  
 2015-10-05 23:19:30,372 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.camel.karaf/camel-karaf-commands/2.15.3  
 2015-10-05 23:19:30,373 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1  
 2015-10-05 23:19:30,373 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.karaf.bundle/org.apache.karaf.bundle.springstate/4.0.1  
 2015-10-05 23:19:30,373 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.spring/4.0.1  
 2015-10-05 23:19:30,373 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/1.0_6  
 2015-10-05 23:19:30,374 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cglib/3.0_1  
 2015-10-05 23:19:30,374 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.6_1  
 2015-10-05 23:19:30,374 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,374 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,375 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,375 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context-support/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,375 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,375 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-expression/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,376 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-tx/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,376 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework/spring-aop/3.1.4.RELEASE  
 2015-10-05 23:19:30,376 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework/spring-asm/3.1.4.RELEASE  
 2015-10-05 23:19:30,377 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework/spring-beans/3.1.4.RELEASE  
 2015-10-05 23:19:30,377 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework/spring-context/3.1.4.RELEASE  
 2015-10-05 23:19:30,377 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework/spring-context-support/3.1.4.RELEASE  
 2015-10-05 23:19:30,377 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework/spring-core/3.1.4.RELEASE  
 2015-10-05 23:19:30,378 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework/spring-expression/3.1.4.RELEASE  
 2015-10-05 23:19:30,378 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework.osgi/spring-osgi-core/1.2.1  
 2015-10-05 23:19:30,378 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework.osgi/spring-osgi-extender/1.2.1  
 2015-10-05 23:19:30,378 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework.osgi/spring-osgi-annotation/1.2.1  
 2015-10-05 23:19:30,379 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.springframework.osgi/spring-osgi-io/1.2.1  
 2015-10-05 23:19:30,379 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.codehaus.woodstox/stax2-api/3.1.4  
 2015-10-05 23:19:30,380 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |    mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1  
 2015-10-05 23:19:30,383 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 | Installing bundles:  
 2015-10-05 23:19:30,383 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.camel/camel-catalog/2.15.3  
 2015-10-05 23:19:30,393 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.camel/camel-commands-core/2.15.3  
 2015-10-05 23:19:30,399 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.camel/camel-core/2.15.3  
 2015-10-05 23:19:30,436 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.camel/camel-spring/2.15.3  
 2015-10-05 23:19:30,447 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.camel.karaf/camel-karaf-commands/2.15.3  
 2015-10-05 23:19:30,451 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1  
 2015-10-05 23:19:30,453 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.karaf.bundle/org.apache.karaf.bundle.springstate/4.0.1  
 2015-10-05 23:19:30,458 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.spring/4.0.1  
 2015-10-05 23:19:30,462 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/1.0_6  
 2015-10-05 23:19:30,465 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cglib/3.0_1  
 2015-10-05 23:19:30,471 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.6_1  
 2015-10-05 23:19:30,485 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,498 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,510 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,536 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-context-support/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,545 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,560 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-expression/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,567 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-tx/3.2.14.RELEASE_1  
 2015-10-05 23:19:30,576 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework/spring-aop/3.1.4.RELEASE  
 2015-10-05 23:19:30,585 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework/spring-asm/3.1.4.RELEASE  
 2015-10-05 23:19:30,590 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework/spring-beans/3.1.4.RELEASE  
 2015-10-05 23:19:30,606 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework/spring-context/3.1.4.RELEASE  
 2015-10-05 23:19:30,636 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework/spring-context-support/3.1.4.RELEASE  
 2015-10-05 23:19:30,655 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework/spring-core/3.1.4.RELEASE  
 2015-10-05 23:19:30,667 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework/spring-expression/3.1.4.RELEASE  
 2015-10-05 23:19:30,673 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework.osgi/spring-osgi-core/1.2.1  
 2015-10-05 23:19:30,684 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework.osgi/spring-osgi-extender/1.2.1  
 2015-10-05 23:19:30,691 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework.osgi/spring-osgi-annotation/1.2.1  
 2015-10-05 23:19:30,696 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.springframework.osgi/spring-osgi-io/1.2.1  
 2015-10-05 23:19:30,702 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.codehaus.woodstox/stax2-api/3.1.4  
 2015-10-05 23:19:30,708 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1  
 2015-10-05 23:19:31,219 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 | Starting bundles:  
 2015-10-05 23:19:31,337 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.aopalliance/1.0.0.6  
 2015-10-05 23:19:31,339 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.asm/3.1.4.RELEASE  
 2015-10-05 23:19:31,341 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.core/3.1.4.RELEASE  
 2015-10-05 23:19:31,343 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.beans/3.1.4.RELEASE  
 2015-10-05 23:19:31,344 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.aop/3.1.4.RELEASE  
 2015-10-05 23:19:31,346 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.expression/3.1.4.RELEASE  
 2015-10-05 23:19:31,347 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.context/3.1.4.RELEASE  
 2015-10-05 23:19:31,349 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.cglib/3.0.0.1  
 2015-10-05 23:19:31,352 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.spring-core/3.2.14.RELEASE_1  
 2015-10-05 23:19:31,354 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.spring-beans/3.2.14.RELEASE_1  
 2015-10-05 23:19:31,356 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.spring-aop/3.2.14.RELEASE_1  
 2015-10-05 23:19:31,357 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.osgi.io/1.2.1  
 2015-10-05 23:19:31,359 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.spring-expression/3.2.14.RELEASE_1  
 2015-10-05 23:19:31,360 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.spring-context/3.2.14.RELEASE_1  
 2015-10-05 23:19:31,362 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.osgi.core/1.2.1  
 2015-10-05 23:19:31,364 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.osgi.extensions.annotations/1.2.1  
 2015-10-05 23:19:31,366 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.osgi.extender/1.2.1  
 2015-10-05 23:19:31,393 | INFO | pool-25-thread-1 | ContextLoaderListener      | 77 - org.springframework.osgi.extender - 1.2.1 | Starting [org.springframework.osgi.extender] bundle v.[1.2.1]  
 2015-10-05 23:19:31,727 | INFO | pool-25-thread-1 | ExtenderConfiguration      | 77 - org.springframework.osgi.extender - 1.2.1 | No custom extender configuration detected; using defaults...  
 2015-10-05 23:19:31,740 | INFO | pool-25-thread-1 | TimerTaskExecutor        | 64 - org.apache.servicemix.bundles.spring-context - 3.2.14.RELEASE_1 | Initializing Timer  
 2015-10-05 23:19:31,839 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.springframework.context.support/3.1.4.RELEASE  
 2015-10-05 23:19:31,841 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.spring-tx/3.2.14.RELEASE_1  
 2015-10-05 23:19:31,842 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.karaf.deployer.spring/4.0.1  
 2015-10-05 23:19:31,854 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.spring-context-support/3.2.14.RELEASE_1  
 2015-10-05 23:19:31,856 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.karaf.bundle.springstate/4.0.1  
 2015-10-05 23:19:31,916 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.camel.camel-catalog/2.15.3  
 2015-10-05 23:19:31,922 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.camel.camel-spring/2.15.3  
 2015-10-05 23:19:31,939 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.camel.camel-core/2.15.3  
 2015-10-05 23:19:31,943 | INFO | pool-25-thread-1 | Activator            | 53 - org.apache.camel.camel-core - 2.15.3 | Camel activator starting  
 2015-10-05 23:19:31,982 | INFO | pool-25-thread-1 | Activator            | 53 - org.apache.camel.camel-core - 2.15.3 | Camel activator started  
 2015-10-05 23:19:32,007 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.camel.camel-commands-core/2.15.3  
 2015-10-05 23:19:32,012 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  stax2-api/3.1.4  
 2015-10-05 23:19:32,014 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  woodstox-core-asl/4.4.1  
 2015-10-05 23:19:32,051 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.geronimo.specs.geronimo-jta_1.1_spec/1.1.1  
 2015-10-05 23:19:32,054 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.servicemix.bundles.jaxb-impl/2.2.6.1  
 2015-10-05 23:19:32,056 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 |  org.apache.camel.karaf.camel-karaf-commands/2.15.3  
 2015-10-05 23:19:32,315 | INFO | pool-25-thread-1 | FeaturesServiceImpl       | 8 - org.apache.karaf.features.core - 4.0.1 | Done.  
 2015-10-05 23:20:53,179 | INFO | nsole user karaf | ultOsgiApplicationContextCreator | 77 - org.springframework.osgi.extender - 1.2.1 | Discovered configurations {osgibundle:/META-INF/spring/*.xml} in bundle [camel-example-osgi (camel-example-osgi)]  
 2015-10-05 23:20:53,219 | INFO | ExtenderThread-1 | OsgiBundleXmlApplicationContext | 64 - org.apache.servicemix.bundles.spring-context - 3.2.14.RELEASE_1 | Refreshing OsgiBundleXmlApplicationContext(bundle=camel-example-osgi, config=osgibundle:/META-INF/spring/*.xml): startup date [Mon Oct 05 23:20:53 MYT 2015]; root of context hierarchy  
 2015-10-05 23:20:53,262 | INFO | ExtenderThread-1 | OsgiBundleXmlApplicationContext | 64 - org.apache.servicemix.bundles.spring-context - 3.2.14.RELEASE_1 | Application Context service already unpublished  
 2015-10-05 23:20:53,325 | INFO | ExtenderThread-1 | XmlBeanDefinitionReader     | 63 - org.apache.servicemix.bundles.spring-beans - 3.2.14.RELEASE_1 | Loading XML bean definitions from URL [bundle://82.0:0/META-INF/spring/camelContext.xml]  
 2015-10-05 23:20:53,611 | INFO | ExtenderThread-1 | CamelNamespaceHandler      | 54 - org.apache.camel.camel-spring - 2.15.3 | OSGi environment detected.  
 2015-10-05 23:20:54,970 | INFO | ExtenderThread-1 | WaiterApplicationContextExecutor | 77 - org.springframework.osgi.extender - 1.2.1 | No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=camel-example-osgi, config=osgibundle:/META-INF/spring/*.xml)  
 2015-10-05 23:20:55,034 | INFO | ExtenderThread-2 | DefaultListableBeanFactory    | 63 - org.apache.servicemix.bundles.spring-beans - 3.2.14.RELEASE_1 | Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@69f2fae4: defining beans [template,consumerTemplate,camel-1:beanPostProcessor,camel-1,myTransform]; root of factory hierarchy  
 2015-10-05 23:20:55,302 | INFO | ExtenderThread-2 | OsgiSpringCamelContext      | 53 - org.apache.camel.camel-core - 2.15.3 | Apache Camel 2.15.3 (CamelContext: camel-1) is starting  
 2015-10-05 23:20:55,304 | INFO | ExtenderThread-2 | ManagedManagementStrategy    | 53 - org.apache.camel.camel-core - 2.15.3 | JMX is enabled  
 2015-10-05 23:20:55,651 | INFO | ExtenderThread-2 | OsgiSpringCamelContext      | 53 - org.apache.camel.camel-core - 2.15.3 | AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.  
 2015-10-05 23:20:55,651 | INFO | ExtenderThread-2 | OsgiSpringCamelContext      | 53 - org.apache.camel.camel-core - 2.15.3 | StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html  
 2015-10-05 23:20:55,742 | INFO | ExtenderThread-2 | OsgiSpringCamelContext      | 53 - org.apache.camel.camel-core - 2.15.3 | Route: route1 started and consuming from: Endpoint[timer://myTimer?fixedRate=true&period=2000]  
 2015-10-05 23:20:55,745 | INFO | ExtenderThread-2 | OsgiSpringCamelContext      | 53 - org.apache.camel.camel-core - 2.15.3 | Total 1 routes, of which 1 is started.  
 2015-10-05 23:20:55,752 | INFO | ExtenderThread-2 | OsgiSpringCamelContext      | 53 - org.apache.camel.camel-core - 2.15.3 | Apache Camel 2.15.3 (CamelContext: camel-1) started in 0.444 seconds  
 2015-10-05 23:20:55,759 | INFO | ExtenderThread-2 | OsgiBundleXmlApplicationContext | 64 - org.apache.servicemix.bundles.spring-context - 3.2.14.RELEASE_1 | Publishing application context as OSGi service with properties {org.springframework.context.service.name=camel-example-osgi, Bundle-SymbolicName=camel-example-osgi, Bundle-Version=2.15.3}  
 2015-10-05 23:20:55,775 | INFO | ExtenderThread-2 | ContextLoaderListener      | 77 - org.springframework.osgi.extender - 1.2.1 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=camel-example-osgi, config=osgibundle:/META-INF/spring/*.xml))  
 2015-10-05 23:20:56,759 | INFO | timer://myTimer | MyTransform           | 82 - camel-example-osgi - 2.15.3 | >>>> SpringDSL set body: Mon Oct 05 23:20:56 MYT 2015  
 2015-10-05 23:20:56,766 | INFO | timer://myTimer | ExampleRouter          | 53 - org.apache.camel.camel-core - 2.15.3 | Exchange[ExchangePattern: InOnly, BodyType: String, Body: SpringDSL set body: Mon Oct 05 23:20:56 MYT 2015]  
 2015-10-05 23:20:58,746 | INFO | timer://myTimer | MyTransform           | 82 - camel-example-osgi - 2.15.3 | >>>> SpringDSL set body: Mon Oct 05 23:20:58 MYT 2015  
 2015-10-05 23:20:58,747 | INFO | timer://myTimer | ExampleRouter          | 53 - org.apache.camel.camel-core - 2.15.3 | Exchange[ExchangePattern: InOnly, BodyType: String, Body: SpringDSL set body: Mon Oct 05 23:20:58 MYT 2015]  
 2015-10-05 23:21:00,746 | INFO | timer://myTimer | MyTransform           | 82 - camel-example-osgi - 2.15.3 | >>>> SpringDSL set body: Mon Oct 05 23:21:00 MYT 2015  
 2015-10-05 23:21:00,747 | INFO | timer://myTimer | ExampleRouter          | 53 - org.apache.camel.camel-core - 2.15.3 | Exchange[ExchangePattern: InOnly, BodyType: String, Body: SpringDSL set body: Mon Oct 05 23:21:00 MYT 2015]  
 2015-10-05 23:21:02,746 | INFO | timer://myTimer | MyTransform           | 82 - camel-example-osgi - 2.15.3 | >>>> SpringDSL set body: Mon Oct 05 23:21:02 MYT 2015  
 2015-10-05 23:21:02,747 | INFO | timer://myTimer | ExampleRouter          | 53 - org.apache.camel.camel-core - 2.15.3 | Exchange[ExchangePattern: InOnly, BodyType: String, Body: SpringDSL set body: Mon Oct 05 23:21:02 MYT 2015]  
 2015-10-05 23:21:04,745 | INFO | timer://myTimer | MyTransform           | 82 - camel-example-osgi - 2.15.3 | >>>> SpringDSL set body: Mon Oct 05 23:21:04 MYT 2015  
 2015-10-05 23:21:04,746 | INFO | timer://myTimer | ExampleRouter          | 53 - org.apache.camel.camel-core - 2.15.3 | Exchange[ExchangePattern: InOnly, BodyType: String, Body: SpringDSL set body: Mon Oct 05 23:21:04 MYT 2015]  
 2015-10-05 23:21:06,745 | INFO | timer://myTimer | MyTransform           | 82 - camel-example-osgi - 2.15.3 | >>>> SpringDSL set body: Mon Oct 05 23:21:06 MYT 2015  
 2015-10-05 23:21:06,746 | INFO | timer://myTimer | ExampleRouter          | 53 - org.apache.camel.camel-core - 2.15.3 | Exchange[ExchangePattern: InOnly, BodyType: String, Body: SpringDSL set body: Mon Oct 05 23:21:06 MYT 2015]  
   
 karaf@root()>  

and if you list again on the bundle, there are multiple instances running.

 karaf@root()> bundle:list  
 START LEVEL 100 , List Threshold: 50  
 ID | State | Lvl | Version | Name  
 -----------------------------------------------------------------------  
 51 | Active | 80 | 2.15.3 | camel-catalog  
 52 | Active | 80 | 2.15.3 | camel-commands-core  
 53 | Active | 80 | 2.15.3 | camel-core  
 54 | Active | 80 | 2.15.3 | camel-spring  
 55 | Active | 80 | 2.15.3 | camel-karaf-commands  
 56 | Active | 80 | 1.1.1  | geronimo-jta_1.1_spec  
 61 | Active | 80 | 2.2.6.1 | Apache ServiceMix :: Bundles :: jaxb-impl  
 80 | Active | 80 | 3.1.4  | Stax2 API  
 81 | Active | 80 | 4.4.1  | Woodstox XML-processor  
 82 | Active | 80 | 2.15.3 | camel-example-osgi  
 karaf@root()>   

Just like docker contaianer, you can stop and uninstall the bundle and then exit apache karaf.

 karaf@root()> bundle:stop camel-example-osgi  
 karaf@root()> bundle:uninstall camel-example-osgi  
 karaf@root()> bundle:list  
 START LEVEL 100 , List Threshold: 50  
 ID | State | Lvl | Version | Name  
 -----------------------------------------------------------------------  
 51 | Active | 80 | 2.15.3 | camel-catalog  
 52 | Active | 80 | 2.15.3 | camel-commands-core  
 53 | Active | 80 | 2.15.3 | camel-core  
 54 | Active | 80 | 2.15.3 | camel-spring  
 55 | Active | 80 | 2.15.3 | camel-karaf-commands  
 56 | Active | 80 | 1.1.1  | geronimo-jta_1.1_spec  
 61 | Active | 80 | 2.2.6.1 | Apache ServiceMix :: Bundles :: jaxb-impl  
 80 | Active | 80 | 3.1.4  | Stax2 API  
 81 | Active | 80 | 4.4.1  | Woodstox XML-processor  
 karaf@root()>   
 karaf@root()> system:shutdown  
 Confirm: halt instance root (yes/no): yes  
 karaf@root()>   
   

In this article, we are just going through the surface on what apache karaf can do and it certainly deliver! If you are looking for docker container alternative, apache karaf certainly worth the time to look into. Hence forth I think these links will provide you further learning experience.

http://liquid-reality.de/display/liquid/Karaf+Tutorials

https://karaf.apache.org/manual/latest/users-guide/

No comments:

Post a Comment