Versions Compared

Key

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

...

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

http://servicemixfelix.apache.org/kernelsite/downloaddownloads.htmlcgi

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 <SERVICEMIX<KARAF_HOME>. Please remember the restrictions concerning illegal characters in Java paths, e.g. !, % etc.

...

With Karaf already installed, open a command line console and change directory to <SERVICEMIX_HOME>. To start the server, run the following command in Windows:

Code Block
bin\servicemixkaraf.bat

respectively on Unix:

Code Block
bin/servicemixkaraf

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

Panel
bgColor#000000

No Format
nopaneltrue
        __ __                  ____      
    __  __ _
/ //_/__|  ___ _ ____   _(_) ___ _/ __|/  \/  (_)_  __
\___ \
      / _,<  \/ '__\ \ `/ ___/ |/ __ `/ /_   \ |\/| | \ \/ /
  ___)  | / __/| |/ /_/ / \/ V /| | (/_|/ / __/  |  | | |>  <
|____/ \___|_|    \/_/ |_|\__,_\___|_|/_/   |\__|,_/_/\_\         

No Format
nopaneltrue
ServiceMix Kernel  Apache Felix Karaf (1.10.0)


Type 'Hit '<tab>' for a list of available commands
and '[cmd] --help' for more information.
--------------------------------------------------------------------------------------------------------------------------------
smx@root:/>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

smx@root:/> help
Available commands:
  about
karaf@root> 

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

You can then grab more specific help for a given command using the --help option for this command:

Panel
bgColor#000000

No Format
nopaneltrue

karaf@root> 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> 

Note that the console supports tab completion, so you just need to enter ad <tab> cr <tab> instead of admin:create.
#top

Deploy a sample application

While you will learn in the remainder of this guide how to use and leverage Apache ServiceMix KernelFelix Karaf, we will just use the pre-built packaging for now.

In the console, run the following commands:

Code Block
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

...