felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Felix > 1. Quick Start
Date Tue, 22 Sep 2009 09:54:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=FELIX&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/FELIX/1.+Quick+Start">1.
Quick Start</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~gnodet">Guillaume
Nodet</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
width='33%' class='ScrollbarPrevName'>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/FELIX/Karaf+Users%27+Guide"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/FELIX/Karaf+Users%27+Guide">Karaf Users' Guide</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/FELIX/2.+Overview">2.
Overview</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/FELIX/2.+Overview"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>
<p><a name="1.QuickStart-top"></a></p>

<h1><a name="1.QuickStart-1.Quickstart"></a>1. Quick start</h1>

<p>If you are in a hurry to have Apache Felix Karaf up and running right away, this
section will provide you with some basic steps for downloading, building (when needed) and
running the server in no time. This is clearly not a complete guide so you may want to check
other sections of this guide for further information.</p>

<p>All you need is 5 to 10 minutes and to follow these basic steps.</p>
<ul>
	<li><a href="#1.QuickStart-Background">Background</a></li>
	<li><a href="#1.QuickStart-Gettingthesoftware">Getting the software</a></li>
	<li><a href="#1.QuickStart-Starttheserver">Start the server</a></li>
	<li><a href="#1.QuickStart-Deployasampleapplication">Deploy a sample application</a></li>
</ul>


<h2><a name="1.QuickStart-Background"></a>Background</h2>

<p>Apache Felix Karaf is a small and lightweight OSGi based runtime.  This provides
a small lightweight container onto which various bundles can be deployed.</p>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>Apache Felix Karaf started
life as the <a href="http://servicemix.apache.org" rel="nofollow">Apache ServiceMix
</a> kernel.<br/>
Don't be surprised by any transitional references which remain. </p></td></tr></table></div>
<p><a href="#1.QuickStart-top">top</a></p>

<h2><a name="1.QuickStart-Gettingthesoftware"></a>Getting the software</h2>

<p>At this time you have one option to get the software. The fastest and easiest way
is to get the binary directly from the Apache site. Since this article is intended to help
you to have Apache Felix Karaf up and running in the fastest way only the binary download
will be covered at this time.</p>

<h3><a name="1.QuickStart-Prerequisites"></a>Prerequisites</h3>

<p>Although this installation path is the fastest one, still you will need to install
some software before installing Karaf.</p>

<p>Karaf requires a Java 5 environment to run. Refer to <a href="http://java.sun.com"
rel="nofollow">http://java.sun.com</a> for details on how to download and install
J2SE 1.5 or greater.</p>

<h3><a name="1.QuickStart-Downloadbinaries"></a>Download binaries</h3>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><p>Karaf is
still working towards it's first release at Felix.<br/>
Binaries are available from <a href="http://servicemix.apache.org" rel="nofollow">Apache
ServiceMix </a>.<br/>
Alternatively see <a href="/confluence/display/FELIX/Quick+Start+%28Source%29" title="Quick
Start (Source)">Quick Start &#40;Source&#41;</a>.</p></td></tr></table></div>

<p>Depending on the platform you plan to install and run Karaf you will select the appropriate
installation image. Open a Web browser and access the following URL, there you will find the
available packages for download (binaries and source code).</p>

<p><a href="http://felix.apache.org/site/downloads.cgi" rel="nofollow">http://felix.apache.org/site/downloads.cgi</a></p>

<p>Select the file compression format compatible with your system (zip for windows,
tar.gz for unixes) by clicking directly on the link, download it and expand the binary to
your hard drive in a new directory; for example in z:\servicemix - from now on this directory
will be referenced as &lt;KARAF_HOME&gt;. Please remember the restrictions concerning
illegal characters in Java paths, e.g. &#33;, % etc.</p>

<p>The installation of Karaf is as simple as uncompressing the .zip or .tar files. The
next step is to start the server.</p>

<p><a href="#1.QuickStart-top">top</a></p>

<h2><a name="1.QuickStart-Starttheserver"></a>Start the server</h2>

<p>With Karaf already installed, open a command line console and change directory to
&lt;SERVICEMIX_HOME&gt;. To start the server, run the following command in Windows:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
bin\karaf.bat
</pre>
</div></div>
<p>respectively on Unix:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
bin/karaf
</pre>
</div></div>
<p>You should see the following informations on the command line console:</p>
<div class="panel" style="background-color: #000000;border-width: 1px;"><div class="panelContent"
style="background-color: #000000;">
<p><font color="#00ffff"><pre>        __ __                  ____      
       / //_/____ __________ _/ __/      
      / ,&lt;  / __ `/ ___/ __ `/ /_        
     / /| |/ /_/ / /  / /_/ / __/        
    /_/ |_|\__,_/_/   \__,_/_/         

</pre></font><font color="#c0c0c0"><pre>  Apache Felix Karaf (1.0.0)

Hit '&lt;tab&gt;' for a list of available commands
and '[cmd] --help' for help on a specific command.

karaf@root&gt; 
</pre></font></p>
</div></div>
<p>You can now run your first command.  Simply type the <tt>&lt;tab&gt;</tt>
key in the console.</p>
<div class="panel" style="background-color: #000000;border-width: 1px;"><div class="panelContent"
style="background-color: #000000;">
<p><font color="#c0c0c0">
<pre>karaf@root&gt; 

admin:change-port        admin:connect            admin:create             admin:destroy 
          admin:list               admin:start
admin:stop               config:cancel            config:edit              config:list   
          config:propappend        config:propdel
config:proplist          config:propset           config:update            features:addUrl
         features:install         features:list
features:listUrl         features:refreshUrl      features:removeUrl       features:uninstall
      log:display              log:display-exception
log:get                  log:set                  osgi:bundle-level        osgi:headers  
          osgi:install             osgi:list
osgi:ls                  osgi:refresh             osgi:resolve             osgi:restart  
          osgi:shutdown            osgi:start
osgi:start-level         osgi:stop                osgi:uninstall           osgi:update   
          packages:exports         packages:imports
shell:cat                shell:echo               shell:exec               shell:grep    
          shell:info               shell:java
shell:printf             shell:sleep              shell:sort               shell:tac     
          ssh:ssh                  ssh:sshd
karaf@root&gt; 
</pre></font></p>
</div></div>
<p>You can then grab more specific help for a given command using the <tt>--help</tt>
option for this command:</p>
<div class="panel" style="background-color: #000000;border-width: 1px;"><div class="panelContent"
style="background-color: #000000;">
<p><font color="#c0c0c0">
<pre>karaf@root&gt; admin:create --help
DESCRIPTION
	admin:create

	Create a new instance.

SYNTAX
	admin:create [options] [VAL]

ARGUMENTS
	VAL	Name of the new Karaf instance

OPTIONS
	-p, --port
		Port number for remote shell connection
	--help
		Display this help message
	-l, --location
		Location of the new instance on the file system

karaf@root&gt; 
</pre></font></p>
</div></div>
<p>Note that the console supports tab completion, so you just need to enter <tt>ad
&lt;tab&gt; cr &lt;tab&gt;</tt> instead of <tt>admin:create</tt>.<br/>
<a href="#1.QuickStart-top">top</a></p>

<h2><a name="1.QuickStart-Deployasampleapplication"></a>Deploy a sample
application</h2>

<p>While you will learn in the remainder of this guide how to use and leverage Apache
Felix Karaf, we will just use the pre-built packaging for now.</p>

<p>In the console, run the following commands:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
osgi:install -s mvn:org.apache.geronimo.specs/geronimo-activation_1.1_spec/1.0.2
osgi:install -s mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.stax-api-1.0/1.1.0
osgi:install -s mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.1/1.1.0
osgi:install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.1.6_1
osgi:install -s mvn:org.apache.camel/camel-core/1.4.0
osgi:install -s mvn:org.springframework/spring-tx/2.5.5
osgi:install -s mvn:org.apache.camel/camel-spring/1.4.0
osgi:install -s mvn:org.apache.camel/camel-osgi/1.4.0
osgi:install -s mvn:org.apache.camel/camel-example-osgi/1.4.0
</pre>
</div></div>
<p>This commands will download, install and start the specified jars.</p>

<p>The example installed is using <a href="http://activemq.apache.org/camel" rel="nofollow">Camel</a>
to start a timer every 2 seconds and output a message on the console.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&gt;&gt;&gt;&gt; MyTransform set body:  Wed Jan 02 23:34:19 CET 2008
&gt;&gt;&gt;&gt; MyTransform set body:  Wed Jan 02 23:34:21 CET 2008
</pre>
</div></div>

<h3><a name="1.QuickStart-Stoppinganduninstallingthesampleapplication"></a>Stopping
and uninstalling the sample application</h3>

<p>To stop this demo, run the following command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
osgi/list | grep example
</pre>
</div></div>
<p>In the output, locate the line containing <tt>camel-example-osgi</tt>
and note the id of the bundle in the first column.  Then launch the following command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
osgi/stop [id]
</pre>
</div></div>
<p>If you wish, you can start again the sample by using the following command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
osgi/start [id]
</pre>
</div></div>
<p>To uninstall the demo, run the following command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
osgi/uninstall [id]
</pre>
</div></div>

<h3><a name="1.QuickStart-CommonProblems"></a>Common Problems</h3>

<ol>
	<li>Launching SMX4 can result in a deadlock in Felix during module dependency resolution.
 This is often a result of sending a SIGINT (control-C) to the process when it will not cleanly
exit.  This can corrupt the caches and cause startup problems in the very next launch. It
is fixed by emptying the component cache:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
rm -rf data/cache/*
</pre>
</div></div></li>
</ol>


<h2><a name="1.QuickStart-StoppingKaraf"></a>Stopping Karaf</h2>

<p>To stop Karaf from the console, run the following command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
exit
</pre>
</div></div>

<h2><a name="1.QuickStart-Summary"></a>Summary</h2>

<p>This document showed you how simple it is to have Apache Felix Karaf up and running.
The overall time for getting the server running should be less than five minutes if you have
the prerequisite (Java 1.5) already installed. Additionally, this article also showed you
how to deploy and test a simple Apache Camel application in less than five minutes.</p>

<p><a href="#1.QuickStart-top">top</a></p>
<style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
width='33%' class='ScrollbarPrevName'>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/FELIX/Karaf+Users%27+Guide"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/FELIX/Karaf+Users%27+Guide">Karaf Users' Guide</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/FELIX/2.+Overview">2.
Overview</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/FELIX/2.+Overview"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/FELIX/1.+Quick+Start">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=74692&revisedVersion=37&originalVersion=36">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/FELIX/1.+Quick+Start?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message