Book Image

Learning Apache Karaf

By : Jamie Goodyear, Johan Edstrom, Heath Kesler
Book Image

Learning Apache Karaf

By: Jamie Goodyear, Johan Edstrom, Heath Kesler

Overview of this book

<p>Apache Karaf is more than just an OSGi-based runtime container; it’s an ecosystem of open source technologies that makes operating and managing applications easier. Karaf supports hot deployment of OSGi bundles by monitoring jar files inside the [home]/deploy directory. Each time a jar is copied in this folder, it will be installed inside the runtime. You can then update or delete it, and changes will be handled automatically. In addition, Karaf also supports exploded bundles and custom deployers.</p> <p>Learning Apache Karaf will introduce developers and administrators alike to the OSGi-based container, and impart best practices by example. The book shows you how to set up an Apache Karaf distribution, and how to arrive at a production-ready deployment. Learning Apache Karaf teaches you everything you need to install, configure, and administer Apache Karaf.</p> <p>Learning Apache Karaf will help guide you through the complexity of an OSGi container using sample code and configuration snippets to demonstrate the important aspects of managing and running a Karaf instance.</p> <p>Learning to install and command the runtime is just the beginning; deploying and provisioning applications is just as important to the successful implementation of a stable and scalable architecture. You will discover how to monitor runtime environments using remote access, logging, and JMX, and you will also develop production-level architectures with high availability and security.</p>
Table of Contents (16 chapters)

Deploying WAR


With OSGi becoming the runtime container of choice, there needs to be ways to deploy different types of archives. Deploying a WAR file is also supported within the Karaf container. In order to get a WAR file to deploy correctly and start, the war feature needs to be installed first. Luckily, we have already started the war feature several times throughout this chapter. In case the Karaf instance has been reset to a clean slate, let's install the war feature again:

karaf@root> features:install war

There, simple enough, now we are ready to install a WAR file of choice.

For this example I am using the non-OSGi-compliant sample.war file from Apache Tomcat available at http://tomcat.apache.org/tomcat-5.5-doc/appdev/sample/sample.war.

Just like the JAR file, the WAR file can be dropped in the [karaf]/deploy directory and it will be picked up, transformed to OSGi-compliant, installed, and started:

[  88] [Active     ] [            ] [   80] sample (0.0.0)

Once it is installed and...