neuhalfen.name

A random collection of posts

Testing Apache Servicemix

Permalink

This travel report will follow the quickstart located on the servicemix website and point out where deviations are needed for Solaris 11.

Preparations as root

These steps need to be done as root.

Install java

You will need java. JDK7 is not (yet) supported, so we’ll install jdk-6. Installing the gnu-utils is not strictly necessary, although they make working easier.

Installing prerequisites.
pkg install pkg:/developer/java/jdk-6 \
pkg:/archiver/gnu-tar \
pkg:/file/gnu-coreutils \
pkg:/text/gnu-diffutils \
pkg:/file/gnu-findutils \
pkg:/text/gnu-grep \
pkg:/text/gnu-patch \
pkg:/text/gnu-sed

Create the user ‘svcmix’

Servicemix will be running under a dedicated user account svcmix.

Servicemix will run as user svcmix
groupadd svcmix
useradd -b /export/home -s /bin/bash -m -k /etc/skel svcmix
usermod -g svcmix svcmix
passwd svcmix
# ...

Installation

All steps are made as user svcmix:

Check that we are not root
svcmix@svcmix1:~$ whoami
svcmix

Download the tar file (Default assembly) and install it. To make working easier SERVICEMIX_HOME/bin is added to the path.

Installing
cd ~
mkdir work
cd work
wget http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/servicemix/servicemix-4/4.4.1/apache-servicemix-4.4.1.tar.gz
gtar xfz apache-servicemix-4.4.1.tar.gz
cd apache-servicemix-4.4.1
export SERVICEMIX_HOME=$PWD
export PATH=$PATH:$SERVICEMIX_HOME/bin
echo "export SERVICEMIX_HOME=$SERVICEMIX_HOME" >> ~/.bashrc
echo "export PATH=$PATH:$SERVICEMIX_HOME/bin" >> ~/.bashrc

local: not found

The first attempt to start servicemix leads to a bunch of error messages:

On Solarislink
pwd
# /home/svcmix/work/apache-servicemix-4.4.1/bin
./servicemix
servicemix: JAVA_HOME not set; results may vary
./servicemix[168]: local: not found [No such file or directory]
./servicemix[178]: local: not found [No such file or directory]
./servicemix[179]: local: not found [No such file or directory]
./servicemix[363]: exec: a tracked alias for /usr/bin/java: not found

The reason for the messages is the shebang of the script: It points to /bin/sh although it should point to /bin/bash.

The fix is easy, just replace the first line of the script.

This patch needs to be applied to all the scripts delivered with Servicemix.
cat <<EOF|patch servicemix
1c1
< #!/bin/sh
---
> #!/bin/bash
EOF

First contact

After fixing up the startscript servicemix is ready to start:

First contact
$ servicemix
servicemix: JAVA_HOME not set; results may vary
____ _ __ __ _
/ ___| ___ _ ____ _(_) ___ ___| \/ (_)_ __
\___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ /
___) | __/ | \ V /| | (_| __/ | | | |> <
|____/ \___|_| \_/ |_|\___\___|_| |_|_/_/\_\
Apache ServiceMix (4.4.1)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown ServiceMix.
karaf@root>

From here on the tutorial works flawlessly.

Wrapping it up in a service

First install the wrapper-script:

Installing the wrapper script for init.d scripts.
# inisde the servicemix cli
# karaf@root> ...
features:install wrapper

As init.d service

This should work on Linux:

Install the init.d script (in theory)
# inisde the servicemix cli
wrapper:install -s AUTO_START -n KARAF -d Karaf -D "Karaf Service"

Solaris is not supported:

Solaris not supported for the init.d script
karaf@root> wrapper:install -s AUTO_START -n KARAF -d Karaf -D "Karaf Service"
Your operating system 'SunOS' is not currently supported.
1

The documentation for start/stop says that bin/start should be sufficient to run karaf as service.

Manually starting the service.
cd $SERVICEMIX_HOME
bin/start
tail -f data/karaf.out
...

Solaris SMF

I am going to use manifold to create the SMF descriptor:

SMF Manifest "servicemix.smf"
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
Created by Manifold
-->
<service_bundle type="manifest" name="servicemix">
<service name="network/integration/servicemix" type="service" version="1">
<create_default_instance enabled="false"/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<method_context>
<method_credential user="svcmix" group="svcmix"/>
<method_environment working_directory="/home/svcmix/work/apache-servicemix-4.4.1">
<envvar name="PATH" value="/usr/bin:/home/svcmix/work/apache-servicemix-4.4.1/bin" />
<envvar name="SERVICEMIX_HOME" value="/home/svcmix/work/apache-servicemix-4.4.1" />
</method_environment>
</method_context>
<exec_method type="method" name="start" exec="/home/svcmix/work/apache-servicemix-4.4.1/bin/start" timeout_seconds="60"/>
<exec_method type="method" name="stop" exec="/home/svcmix/work/apache-servicemix-4.4.1/bin/stop" timeout_seconds="60"/>
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="contract"/>
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<property_group name="application" type="application">
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">
Apache Servicemix
</loctext>
</common_name>
</template>
</service>
</service_bundle>

You can validate the XML file with svccfg validate servicemix.smf
And create the SMF service with svccfg import servicemix.smf
Enable service with svcadm enable servicemix

You can check if it is running by browsing to http://{HOST}:8181/system/console/bundles

The default user/pw is jmx/jmx.

Deploying JBI archives

features:install jbi

Comments