Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
borderStylesolid
$ mvn clean package-Pfastinstall

Distributions will be created in assembly/target. Select the file compression format compatible with your system (apache-felix-karaf-1.20.0-SNAPSHOT.zip for windows, apache-felix-karaf-1.20.0-SNAPSHOT.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.

...

Tip

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.felix.karaf (for example org.apache.felix.karaf.gshellshell.core)

#top

Start the server

...

You should see the following informations on the command line console:

Panel
bgColor#000000


No Format
nopaneltrue

        __ __                  ____
       / //_/____ __________ _/ __/
      / ,<  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

 Apache Felix Karaf (1
.2.0-SNAPSHOT) Type '
.0.0)
  Apache Felix Karaf (1.0.0)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for
more information. -----------------------------------------------------------------------------------------------------------------------------------------------------------------
 help on a specific command.

karaf@root:/> 

You can now run your first command. Simply enter help type the <tab> key in the console followed by a carriage return.

Panel
bgColor#000000


No Format
nopaneltrue

karaf@root:/> help Available commands: Available commands: osgi
karaf@root> 

admin:change-port        admin:connect            admin:create            
Command
 
group: osgi
admin:destroy         
features
  
Command
 
group
admin:list 
features
   
about
     
Display
 
information
 
about
 
the
 
current
 
GShell
 
application.
admin:start
admin:stop  
help
      
Display
 
help
 
for
 
the
 
current
 
context.
  
exit
config:cancel      
Exit
 
the
 
current
 
shell.
  
echo
 config:edit     
Print
 
arguments
 
to
 
standard
 
output.
  
clear
   config:list  
Clear
 
the
 
terminal
 
screen.
  
source
    
Read
 
and
 
execute
 
commands
config:propappend 
from
 
a
 
file
 
in
 
the
 
current
 
shell
 
environment.
config:propdel
config:proplist       
set
   config:propset    
Set
  
a
 
variable
 
or
 
property.
  
unset
config:update     
Unset
 
a
 
variable
 
or
 
property.
  
alias
 features:addUrl    
Define
 
an
 
alias.
  
unalias
  features:install 
Undefine
 
an
 
alias.
  
history
   
Display
 
history.
features:list
features:listUrl  
info
      
Display
 
JVM
features:refreshUrl 
informations
 
about
 
the
 
current
 
application.
 features:removeUrl 
ssh
      features:uninstall 
SSH
 
client.
  
sshd
   log:display   
SSH
 
server.
  
exec
      
Execute
 
system processes. java
 log:display-exception
log:get              
Execute
 
a
 
Java
 
standard application.
 log:set  
sleep
     
Sleep
 
for
 
a
 
bit
 
then
 
wake
 
up.
  
date
   osgi:bundle-level   
Displays
 
the
 
current
 
time
 
and date.
 osgi:headers  
edit
      
Edit
 
a
 
file
 
with
 
an
 
external editor.
osgi:install   
find
      
Find
 
files
 
in
 
a
 
hierarchy.
osgi:list
osgi:ls   
sort
      
Sort
 
lines
 
of
 
text.
  
hostname
  
Displays
 
the
 
name
osgi:refresh 
of
 
the
 
current
 
host.
  
printf
    
Print
 
formatted
 
output.
 osgi:resolve 
cat
       
Displays
 
the
 
contents
 
of
 
a file.
 osgi:restart  
grep
      
Displays
 
lines
 
matching
 
a
 
pattern.
 osgi:shutdown 
cd
        
Changes
 
the
 
current
 
directory.
osgi:start
osgi:start-level  
pwd
       osgi:stop  
Displays
 
the
 
current
 
directory.
  
ls
        
List
 
the
osgi:uninstall 
contents
 
of
 
a
 
file
 
or
 
directory.
  
cp
   osgi:update     
Copies
 
a
 
file
 
or
 
directory.
  
rm
   packages:exports     
Remove
 
a
 
file
 
or
 
directory.
packages:imports
shell:cat     
fileinfo
  
Displays
 
information
 
about
 
a
 
file.
  
touch
   shell:echo  
Sets
 
the
 
last-modified
 
time
 
of
 
a
 
file.
  
config
    
Command
 
group
shell:
config
exec         
admin
     
Command
 
group
shell:
admin
grep            
packages
  
Command
 
group
shell:info     
packages
  
log
       
Command
 
group
shell:java
shell:printf 
log
     
quit
      
Link
 
to: exit
shell:sleep        
print
     
Link
 
to
shell:
echo
sort       
dir
       
Link
 
to: ls
shell:tac         
copy
      
Link
 
to: cp
ssh:ssh          
del
       
Link
 
to
ssh:sshd
karaf@root> 
rm

#top

Deploy a sample application

...

In the console, run the following commands:

Code Block
osgi/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.56.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

...

To stop this demo, run the following command:

Code Block
osgi/:list | grep example

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]

If you wish, you can start again the sample by using the following command:

Code Block
osgi/:start [id]

To uninstall the demo, run the following command:

Code Block
osgi/:uninstall [id]

Common Problems

...

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

Code Block

^D

Alternatively, you can also run the following command:

Code Block
exitosgi: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.

...