Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

top

2.1. Quick Start (Source)

...

If

...

you

...

are

...

in

...

a

...

hurry

...

to

...

have

...

Apache

...

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 Karaf is a small and lightweight OSGi based runtime. This provides a small lightweight container onto which various bundles can be deployed.

...

Apache Felix Karaf started life as the Apache ServiceMix kernel and then moved as a Apache Felix subproject.
Don't be surprised by any transitional references which remain.

...

#top

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/

...

karaf/trunk/

...

.

...

To

...

check

...

out

...

with

...

a

...

command

...

line

...

client:

...

...

Build

Change directory to the top level of the source checkout. Build Karaf using Maven as follows:

...

Distributions will be created in assembly/target. Select the file compression format compatible with your system (apache-karaf-2.0.0.zip

...

for

...

windows,

...

apache

...

-karaf-

...

2.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.

...

...

To generate Eclipse projects for all modules, in KARAF_HOME

...

type:

...

mvn

...

-Psetup.eclipse

...

Then

...

add

...

each

...

module

...

location,

...

prefixing

...

each

...

name

...

with

...

org.apache

...

.karaf

...

(for

...

example

...

org.apache.

...

karaf.shell.core

...

)

#top

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:

...

...

respectively

...

on

...

Unix:

...

...

You

...

should

...

see

...

the

...

following

...

informations

...

on

...

the

...

command

...

line

...

console:

...

...

You

...

can

...

now

...

run

...

your

...

first

...

command.

...

Simply

...

type

...

the

...

<tab>

...

key

...

in

...

the

...

console.

...

#top

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:

...

This

...

commands

...

will

...

download,

...

install

...

and

...

start

...

the

...

specified

...

jars.

...

The

...

example

...

installed

...

is

...

using

...

Camel

...

to

...

start

...

a

...

timer

...

every

...

2

...

seconds

...

and

...

output

...

a

...

message

...

on

...

the

...

console.

...

...

Stopping and uninstalling the sample application

To stop this demo, run the following command:

...

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:

...

...

If

...

you

...

wish,

...

you

...

can

...

start

...

again

...

the

...

sample

...

by

...

using

...

the

...

following

...

command:

...

...

To

...

uninstall

...

the

...

demo,

...

run

...

the

...

following

...

command:

...

...

Common Problems

  1. Launching SMX4 can result in a deadlock in Felix during module dependency resolution. This is often a result of sending a SIGINT (control-C)

...

  1. to

...

  1. the

...

  1. process

...

  1. when

...

  1. it

...

  1. will

...

  1. not

...

  1. cleanly

...

  1. exit.

...

  1. This

...

  1. can

...

  1. corrupt

...

  1. the

...

  1. caches

...

  1. and

...

  1. cause

...

  1. startup

...

  1. problems

...

  1. in

...

  1. the

...

  1. very

...

  1. next

...

  1. launch.

...

  1. It

...

  1. is

...

  1. fixed

...

  1. by

...

  1. emptying

...

  1. the

...

  1. component

...

  1. cache:

...

  1. rm

...

  1. -rf

...

  1. data/cache/*

...

Stopping Karaf

To stop Karaf from the console, enter ^D in the console:

...

Alternatively, you can also run the following command:

...

Summary

This document showed you how simple it is to have Apache 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

...