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

...

anchortoptop

...

2. Quick start

Wiki MarkupIf you are in a hurry to have Apache ServiceMix Karaf up and running right away, this article 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 the other links in the \[\] main section for further other sections of this guide for further information.

All you need is 5 to 10 minutes and to follow these basic steps.

Background

Apache ServiceMix Runtime Karaf is a small and lightweight OSGi based rutimeruntime. This provides a small lightweight container onto which various bundles can be deployed.

...

Apache 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

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 ServiceMix Karaf up and running in the fastest way only the binary download will be covered at this time.

Prerequisites

Although this installation path is the fastest one, still you will need to install some software before installing ServiceMixKaraf.

ServiceMix 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. If you already have a Java 5 , 6 or 7 environment installed, you can just use that oneor greater.

Download binaries

Depending on the platform you plan to install and run Apache ServiceMix 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://servicemixkaraf.apache.org/download.html

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

The installation of Apache ServiceMix Karaf is as simple as uncompressing the .zip or .tar files. The next step is to start the server.

#top

Start the server

With Apache ServiceMix Karaf already installed, open a command line console and change directory to <SERVICEMIX<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:

Panel
bgColor#000000

No Format
nopaneltrue

Welcome to ServiceMix.
=====================

INFO: Starting to monitor the deploy directory: ./deploy every 500 millis
INFO: Config directory is at: ./etc
INFO: Will generate bundles from expanded source directories to: ./data/generated-bundles
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling SLF4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling Jakarta Commons Logging API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling Log4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator] : Enabling Avalon Logger API support.
[FelixDispatchQueue] INFO [undefined] - BundleEvent STARTED
No Format
nopaneltrue
 ____                  _          __  __ _
/ ___|  ___ _ ____   _(_) ___ ___|  \/  (_)_  __
\___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ /
 ___) |  __/ |   \ V /| | (_|  __/ |  | | |>  <
|____/ \___|_|    \_/ |_|\___\___|_|  |_|_/_/\_\
No Format
nopaneltrue

 ServiceMix (0.1-SNAPSHOT)

Type 'help' for more information.
--------------------------------------------------------------------------------------------------------------------------------
gnodet@Guillaume-Nodets-MacPro.local:/>

Problems starting the Server

...

You can now run your first command. Simply type the <tab> key in the console.

...

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

...

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 create and package a JBI applicationuse and leverage Apache Karaf, we will just use the pre-built packaging for now.

Note: This requires ServiceMix 3.0 and does not work with 3.0M2 or prior. 

Open another command line console in the <servicemix_home> directory and In the console, run the following commands in Windows

Code Block

copy components\servicemix-shared-*.zip install
copy components\servicemix-http-*.zip install
copy components\servicemix-jsr181-*.zip install
copy examples\wsdl-first\wsdl-first-sa-*.zip deploy

respectively Linux:

Code Block

cp components/servicemix-shared-*.zip install
cp components/servicemix-http-*.zip install
cp components/servicemix-jsr181-*.zip install
cp examples/wsdl-first/wsdl-first-sa-*.zip deploy

These commands will:

  • install the servicemix-shared Shared Library
  • install the servicemix-http and servicemix-jsr181 JBI components
  • deploy a JBI Service Assembly which exposes a service over HTTP/SOAP
Warning
titleLaunch directory

ServiceMix deploy and install directories are relative to the directory where ServiceMix was started. Be sure to start it from the root dir using the bin/servicemix command. If you run it from the bin dir, the previous commands will fail and you would have to copy the components to the bin/install and bin/deploy folders.

You should see the following on the command line console:

No Format
borderStylesolid

INFO  - AutoDeploymentService          - Directory: install: Archive changed: processing servicemix-shared-3.0-incubating-installer.zip ...
INFO  - AutoDeploymentService          - Directory: install: Finished installation of archive:  servicemix-shared-3.0-incubating-installer.zip
INFO  - AutoDeploymentService          - Directory: install: Archive changed: processing servicemix-http-3.0-incubating-installer.zip ...
INFO  - jetty                          - Logging to org.apache.servicemix.http.jetty.JCLLogger@12ef4c6 via org.apache.servicemix.http.jetty.JCLLogger
INFO  - ComponentMBeanImpl             - Starting component: servicemix-http
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-http
INFO  - AutoDeploymentService          - Directory: install: Finished installation of archive:  servicemix-http-3.0-incubating-installer.zip
INFO  - AutoDeploymentService          - Directory: install: Archive changed: processing servicemix-jsr181-3.0-incubating-installer.zip ...
INFO  - ComponentMBeanImpl             - Starting component: servicemix-jsr181
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-jsr181
INFO  - AutoDeploymentService          - Directory: install: Finished installation of archive:  servicemix-jsr181-3.0-incubating-installer.zip
INFO  - AutoDeploymentService          - Directory: deploy: Archive changed: processing wsdl-first-sa-3.0-incubating.zip ...
INFO  - ServiceAssemblyLifeCycle       - Starting service assembly: wsdl-first-sa
INFO  - ServiceUnitLifeCycle           - Initializing service unit: wsdl-first-jsr181-su
INFO  - ServiceUnitLifeCycle           - Initializing service unit: wsdl-first-http-su
INFO  - ServiceUnitLifeCycle           - Starting service unit: wsdl-first-jsr181-su
INFO  - ServiceUnitLifeCycle           - Starting service unit: wsdl-first-http-su
INFO  - jetty                          - jetty-6.0.0rc4
INFO  - jetty                          - Started SelectChannelConnector @ localhost:8192
INFO  - AutoDeploymentService          - Directory: deploy: Finished installation of archive:  wsdl-first-sa-3.0-incubating.zip

Now, open a web browser to the following location:

http://localhost:8192/PersonService/main.wsdl

You should see the WSDL of the web service that has just deployed!

Wiki Markup
Now, open a web browser and point it to the following location: {{\[servicemix_home\]/examples/wsdl-first/client.html}}.  Then, click on the {{SEND}} button to see the web service response.

Warning
titleIE users

If your version of ServiceMix is older than 3.0.1, and you are using Internet Explorer, you will have to comment out the following line in the client.html web page.

No Format

/* netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite"); */

This has been be fixed in the 3.1 release.

#top

Summary

:

...

The example installed is using Camel to start a timer every 2 seconds and output a message on the console. The previous commands download the Camel features descriptor and install the example feature.

...

Stopping and uninstalling the sample application

To stop this demo, run the following command:

...

Common Problems

  1. Launching Karaf 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: rm -rf 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 This article showed you how simple it is to have Apache ServiceMix 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 Web Service Apache Camel application in less than five minutes.

#top

...