Wiki Markup |
---|
{scrollbar}
{anchor:top}
h1. |
Anchor | ||||
---|---|---|---|---|
|
1.1
...
Quick
...
Start
...
(Source)
...
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
...
checking
...
out,
...
building
...
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.
...
All
...
you
...
need
...
is
...
15
...
minutes
...
and
...
to
...
follow
...
these
...
basic
...
steps.
...
Background
Apache Felix Karaf is a small and lightweight OSGi based runtime. This provides a small lightweight container onto which various bundles can be deployed.
Tip |
---|
Apache Felix Karaf started life as the Apache ServiceMix kernel. |
Getting the software
This document describes how to build the server from the latest Karaf source.
Prerequisites
Although this installation path is the fastest one, still you will need to install some software before installing Karaf.
Karaf requires a Java 5 environment to run. Refer to http://java.sun.com
...
for
...
details
...
on
...
how
...
to
...
download
...
and
...
install
...
J2SE
...
1.5
...
or
...
greater.
...
Subversion is required to checkout the source.
Maven 2 is required to build Karaf.
Checkout Source
The Karaf source is found at http://svn.apache.org/repos/asf/felix/trunk/karaf/.
...
To
...
check
...
out
...
with
...
a
...
command
...
line
...
client:
Code Block | ||||
---|---|---|---|---|
| =
| |||
}
$ svn co http://svn.apache.org/repos/asf/felix/trunk/karaf/
|
Build
Change directory to the top level of the source checkout. Build Karaf using Maven as follows:
Code Block | ||
---|---|---|
| ||
{code} h3. Build Change directory to the top level of the source checkout. Build Karaf using Maven as follows: {code:borderStyle=solid} $ mvn -Pfastinstall {code} |
Distributions
...
will
...
be
...
created
...
in
...
assembly/target.
...
Select
...
the
...
file
...
compression
...
format
...
compatible
...
with
...
your
...
system
...
(apache-felix-karaf-1.0.0.zip
...
for
...
windows,
...
apache-felix-karaf-1.0.0.tar.gz
...
for
...
unixes)
...
and
...
expand
...
the
...
binary
...
in
...
a
...
new
...
directory;
...
for
...
example
...
in
...
z:\karaf
...
-
...
from
...
now
...
on
...
this
...
directory
...
will
...
be
...
referenced
...
as
...
<KARAF_HOME>.
...
Please
...
remember
...
the
...
restrictions
...
concerning
...
illegal
...
characters
...
in
...
Java
...
paths,
...
e.g.
...
!,
...
%
...
etc.
...
The
...
installation
...
of
...
Karaf
...
is
...
as
...
simple
...
as
...
uncompressing
...
the
...
.zip
...
or
...
.tar
...
files.
...
The
...
next
...
step
...
is
...
to
...
start
...
the
...
server.
Tip |
---|
To generate Eclipse projects for all modules, in {tip} To generate Eclipse projects for all modules, inKARAF_HOME type: mvn -Psetup.eclipse Then add each module location, prefixing each name with _org.apache.felix.karaf _(for example _org.apache.felix.karaf.shell.core) |
Start the server
With Karaf already installed, open a command line console and change directory to <KARAF_HOME>. To start the server, run the following command in Windows:
Code Block |
---|
_) {tip} [#top] {style} .screenshot { font-family:Helvetica,Arial,sans-serif; font-size: 9pt; line-height: 13pt; background-color: black; color: #c0c0c0; padding: 12px 12px; border-style:solid; border-width:1px; margin:10px 20px; overflow:hidden; } {style} h2. Start the server With Karaf already installed, open a command line console and change directory to <KARAF_HOME>. To start the server, run the following command in Windows: {code} bin\karaf.bat {code} |
respectively
...
on
...
Unix:
Code Block |
---|
} bin/karaf {code} |
You
...
should
...
see
...
the
...
following
...
informations
...
on
...
the
...
command
...
line
...
console:
...
Include Page | ||||
---|---|---|---|---|
|
...
|
...
|
...
You
...
can
...
now
...
run
...
your
...
first
...
command.
...
Simply
...
type
...
the
...
<tab>
...
key
...
in
...
the
...
console.
Code Block | ||
---|---|---|
| ||
{div:class=screenshot} {noformat:nopanel=true} karaf@root> 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> {noformat} {div} [#top] h2. Deploy a sample application 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. In the console, run the following commands: {code} |
Deploy a sample application
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.
In the console, run the following commands:
Code Block |
---|
features:install spring-dm
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.6.SEC01
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
{code}
|
This
...
commands
...
will
...
download,
...
install
...
and
...
start
...
the
...
specified
...
jars.
...
The
...
example
...
installed
...
is
...
using
...
...
to
...
start
...
a
...
timer
...
every
...
2
...
seconds
...
and
...
output
...
a
...
message
...
on
...
the
...
console.
Code Block |
---|
} >>>> MyTransform set body: Wed Jan 02 23:34:19 CET 2008 >>>> MyTransform set body: Wed Jan 02 23:34:21 CET 2008 {code} h3. Stopping and uninstalling the sample application To stop |
Stopping and uninstalling the sample application
To stop this demo, run the following command:
Code Block |
---|
this demo, run the following command: {code} osgi:list | grep example {code} |
In
...
the
...
output,
...
locate
...
the
...
line
...
containing
...
camel-example-osgi
...
and
...
note
...
the
...
id
...
of
...
the
...
bundle
...
in
...
the
...
first
...
column.
...
Then
...
launch
...
the
...
following
...
command:
Code Block |
---|
} osgi:stop [id] {code} |
If
...
you
...
wish,
...
you
...
can
...
start
...
again
...
the
...
sample
...
by
...
using
...
the
...
following
...
command:
Code Block |
---|
} osgi:start [id] {code} |
To
...
uninstall
...
the
...
demo,
...
run
...
the
...
following
...
command:
Code Block |
---|
} osgi:uninstall [id] {code} h3. Common Problems # Launching SMX4 can result in a deadlock in Felix during module dependency resolution. This is often a result of sending a SIGINT |
Common Problems
- 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:
...
Code Block
...
rm -rf data/cache/*
Stopping Karaf
To stop Karaf from the console, enter ^D
in the console:
Code Block |
---|
^D
|
Alternatively, you can also run the following command:
Code Block |
---|
osgi:shutdown
|
Summary
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.
Wiki Markup |
---|
{code}
h2. Stopping Karaf
To stop Karaf from the console, enter {{^D}} in the console:
{code}
^D
{code}
Alternatively, you can also run the following command:
{code}
osgi:shutdown
{code}
h2. Summary
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.
[#top]
{scrollbar} |