Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.apache.camel.example</groupId>
	<artifactId>reportincident.web</artifactId>
	<packaging>war</packaging> (1)
	<version>1.0-SNAPSHOT</version>
	<name>Report Incident Web Bundle</name>

	<properties><parent>
		<wicket<groupId>org.version>1apache.3camel.5<example</wicket.version>groupId>
		<jetty.version>6.1.4</jetty.version>
		<felix-version>1.4.3</felix-version>
		<spring-version>2.5.6</spring-    <artifactId>reportincident.parent</artifactId>
	    <version>1.0-SNAPSHOT</version>
	</properties>parent>

	<dependencies>
		<dependency>
			<groupId>org.apache.camel.example</groupId>
			<artifactId>reportincident.service</artifactId>
			<version>1.0-SNAPSHOT</version>
			<scope>provided</scope>
		</dependency>
		
		<!-- SPRING DEPENDENCIES -->
	    <dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring-version}</version>
			<scope>provided</scope>
		</dependency>
	    <dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>${spring-version}</version>
			<scope>provided</scope>
		</dependency>
		<!-- 
	    <dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring-version}</version>
			<scope>provided</scope>
		</dependency>
		 -->
		<!--  WICKET DEPENDENCIES -->
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket</artifactId>
			<version>${wicket.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket-spring-annot<spring</artifactId>
			<version>${wicket.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket-ioc</artifactId>
			<version>${wicket.version}</version>
			<scope>provided</scope>
		</dependency>
                <dependency>
                        <groupId>org.apache.wicket</groupId>
			<artifactId>wicket-extensions</artifactId>
			<version>${wicket.version}</version>
			<scope>provided</scope>
		</dependency>

		<!-- LOGGING DEPENDENCIES - LOG4J -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.4.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.14</version>
			<scope>test</scope>
		</dependency>

		<!--  JUNIT DEPENDENCY FOR TESTING -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.2</version>
			<scope>test</scope>
		</dependency>

		<!--  JETTY DEPENDENCIES FOR TESTING  -->
		<dependency>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>jetty</artifactId>
			<version>${jetty.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>jetty-util</artifactId>
			<version>${jetty.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>jetty-management</artifactId>
			<version>${jetty.version}</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	<build>
		<resources>
			<resource>
				<filtering>false</filtering>
				<directory>src/main/resources</directory>
			</resource>
			<resource>
				<filtering>false</filtering>
				<directory>src/main/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<filtering>false</filtering>
				<directory>src/test/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</testResource>
		</testResources>
		<plugins>

			<plugin>
				<inherited>true</inherited>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.5</source>
					<target>1.5</target>
					<optimise>true</optimise>
					<debug>true</debug>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
			</plugin>


			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.1-alpha-2</version>
				<configuration>
					<archive>
						<!-- add the generated manifest to the war --> (2)
						<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
					</archive>
					<!-- 
					<webResources>
						<resource>
							<directory>src/main/resources/META-INF/spring</directory>
							<targetPath>META-INF/spring</targetPath>
						</resource>
					</webResources>
					 -->
				</configuration>

			</plugin>


			<!-- to generate the MANIFEST-FILE required by the bundle -->
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>${felix-version}</version>
				<extensions>true</extensions>
				<executions> (3)
					<execution>
						<id>bundle-manifest</id>
						<phase>process-classes</phase>
						<goals>
							<goal>manifest</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<supportedProjectTypes>
						<supportedProjectType>bundle</supportedProjectType> (3)
						<supportedProjectType>war</supportedProjectType>
					</supportedProjectTypes>
					<instructions>
						<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
						<Bundle-ClassPath>
							.,
							WEB-INF/classes,
						</Bundle-ClassPath>
						<Import-Package>
							javax.servlet;version="[2.5.0, 3.0.0)",
							javax.servlet.http;version="[2.5.0, 3.0.0)",
							javax.servlet.resources;version="[2.5.0, 3.0.0)",
							org.apache.camel.example.reportincident.service,
							org.springframework.web.context;version="[2.5.6, 3.0.0)",
							org.springframework.web.context.support;version="[2.5.6, 3.0.0)",
							org.springframework.osgi.web.context.support,
							org.xml.sax;resolution:=optional,
							org.w3c.dom;resolution:=optional,
							*
						</Import-Package>
						<Private-Package>org.apache.camel.example.reportincident</Private-Package>
						<Export-Package></Export-Package>
						<Webapp-Context>reportincidentweb</Webapp-Context> (4)
						<_failok>true</_failok>
					</instructions>
				</configuration>

			</plugin>
		</plugins>
	</build>
</project>

...

To build the project, you must execute for each project the following maven commands command in the root of the installation directory :

Project name

maven command

reportincident.activemq

clean install org.ops4j:maven-pax-plugin:eclipse

reportincident.camelqueueservice

clean install org.ops4j:maven-pax-plugin:eclipse

reportincident.db

mvn clean install

reportincident.features

mvn clean install

reportincident.model

mvn clean install org.ops4j:maven-pax-plugin:eclipse

reportincident.persistence

mvn clean install org.ops4j:maven-pax-plugin:eclipse

reportincident.routing

mvn clean install org.ops4j:maven-pax-plugin:eclipse

reportincident.service

mvn clean install org.ops4j:maven-pax-plugin:eclipse

reportincident.web

mvn clean install

reportincident.webservice

mvn clean install org.ops4j:maven-pax-plugin:eclipse

Info

We will try to provide for the next version of this tutorial a parent pom.xml containing the modules to be build (wink)

Package

To simplify our deployment procedure, we will use the provisioning mechanism of Apache Servicemix called 'Feature'. In a feature xml file, we will define the bundles that we will package and their dependencies. The bundles can be linked to a feature and features can be linked together. This file will be packaged in a jar.

The advantage of the feature is that you avoid to deploy manually your bundles in your OSGI server and they can be versioned as you will see in the file. Moreover, the feature can be seen as a contract between your development and the deployment team. Different versions can be created according to the environment where the code will be deployed (development, acceptance and production).

Tip

If you prefer to generate automatically the file based on the dependencies of yours pom, then you can use the maven plugin maven-features-plugin

Create the file reportincident.features-1.0-SNAPSHOT-features.xml in the directory src/main of the project reportincident.features

Remarks :
(1) - The reportincident feature has the number version 1.0
(2) - Each feature is a collection of bundles or bundles/features. The bundle tag contains the URI syntax used by PAX URI to install the JAR or the resource on the OSGI server. We us the mvn protocol to download the jar from Maven repository but other protocols exist (see OPS4J for more info)
(3) - The camel feature include a list of camel-xx features.

Code Block

mvn clean install -Dtest=false  -DfailIfNoTests=false

Package

To simplify our deployment procedure, we will use the provisioning mechanism of Apache Felix Karaf called 'Feature'. In a feature xml file, we will define the bundles that we will package and their dependencies. The bundles can be linked to a feature and features can be linked together. This file will be packaged in a jar.

The advantage of the feature is that you avoid to deploy manually your bundles in your OSGI server and they can be versioned as you will see in the file. Moreover, the feature can be seen as a contract between your development and the deployment team. Different versions can be created according to the environment where the code will be deployed (development, acceptance and production).

Tip

If you prefer to generate automatically the file based on the dependencies of yours pom, then you can use the maven plugin maven-features-plugin

Create the file reportincident.features-1.0-SNAPSHOT-features.xml in the directory src/main of the project reportincident.features

Remarks :
(1) - The reportincident feature has the number version 1.0
(2) - Each feature is a collection of bundles or bundles/features. The bundle tag contains the URI syntax used by PAX URI to install the JAR or the resource on the OSGI server. We us the mvn protocol to download the jar from Maven repository but other protocols exist (see OPS4J for more info)
(3) - The camel feature include a list of camel-xx features.

Code Block
xml
xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<features>
	
   
Code Block
xmlxml

<?xml version="1.0" encoding="UTF-8"?>
<features>
	<feature name="reportincident" version="1.0-SNAPSHOT"> (1)
	
	<bundle>mvn:org.apache.camel.example/reportincident.activemq/1.0-SNAPSHOT</bundle> (2)
		<bundle>mvn:org.apache.camel.example/reportincident.queueservice/1.0-SNAPSHOT</bundle>
		<bundle>mvn:org.apache.camel.example/reportincident.model/1.0-SNAPSHOT</bundle>
		<bundle>mvn:org.apache.camel.example/reportincident.persistence/1.0-SNAPSHOT</bundle>
		<bundle>mvn:org.apache.camel.example/reportincident.service/1.0-SNAPSHOT</bundle>
		<bundle>mvn:org.apache.camel.example/reportincident.webservice/1.0-SNAPSHOT</bundle>
		<bundle>mvn:org.apache.camel.example/reportincident.routing/1.0-SNAPSHOT</bundle>
                <bundle>mvn:org.apache.camel.example/reportincident.web/1.0-SNAPSHOT/war</bundle>
	    </feature>
	
	    <feature name="cameltransaction" version="2.0-M1">
		<feature>camel-core</feature> (3)
		<feature>camel-spring</feature>
		<feature>camel-osgi</feature>
		<feature>camel-bindy</feature>
		<feature>camel-jms</feature>
		<feature>camel-cxf</feature>
		<feature>camel-activemq</feature>
	</feature>

	<feature name="camel-core">
		1.0.0">
	<bundle>mvn:org.apache.camelgeronimo.specs/camel-core/2.0-M1</bundle>
	</feature>

	<feature name="camel-spring">
		geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle>mvn:org.apache.camel/camel-springgeronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0-M1<.0</bundle>
	</feature>

	<feature name="camel-osgi">
		        <bundle>mvn:org.apache.camel/camel-osgi/2.0-M1</bundle>
	</feature>

	<feature name="camel-bindy">
	servicemix.bundles/org.apache.servicemix.bundles.howl/1.0.1-1_1</bundle>
   	<bundle>mvn:org.apache.geronimo.camelcomponents/camelgeronimo-bindytransaction/2.02-M1<r634076</bundle>
	</feature>
	
	<feature name="camel-mail">
	     	<bundle>mvn:org.apache.springframework/spring-context-support/2.5.5<servicemix.transaction/org.apache.servicemix.transaction/1.0.0</bundle> 
       <bundle>mvn:org.apache.camel/camel-mail/2.0-M1</bundle>
	</feature>
	
    <feature name="camel-velocityconnector" version="4.0.0">
       <bundle>mvn:org.apache.servicemix.bundles/ <feature version="1.0.0">transaction</feature>
        <bundle>mvn:org.apache.servicemixgeronimo.bundles.velocity/specs/geronimo-j2ee-connector_1.5_1<spec/2.0.0</bundle>
 
       <bundle>mvn:org.apache.camelgeronimo.components/camelgeronimo-velocityconnector/2.0-M1<1.3</bundle>
	</feature>

	<feature name="camel-jms">
        <bundle>mvn:org.springframework/spring-jms/2.5.6</bundle>	apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle>
        
		<bundle>mvn:org.apache.geronimo.camelspecs/camel-jms/2.0-M1</bundle>
	</feature>

	<feature name="camel-activemq">
		<feature>activemq</feature>
		<bundle>mvn:org.apache.activemq/activemq-camel/5.2.0</bundle>
	</feature>

	<feature name="camel-cxf">
		<feature>cxf</feature>
		<bundle>mvn:org.apache.camel/camel-cxf/2.0-M1</bundle>
	</feature>
	
	<feature name="cxf-osgi">
		<bundle>mvn:org.apache.servicemix.cxf/org.apache.servicemix.cxf.transport.osgi/4.0.0</bundle>
	</feature>

	<feature name="cxf" version="2.2">
		geronimo-servlet_2.5_spec/1.1.2</bundle> 
        <bundle>mvn:org.springframework/spring-tx/2.5.6.SEC01</bundle>
        <bundle>mvn:org.jencks/jencks/2.2</bundle>
    </feature>
		
   <feature name="activemq" version="5.3.0">
        <feature version="4.0.0">connector</feature>
        <bundle>mvn:org.apache.servicemixgeronimo.bundles/org.apache.servicemix.bundles.fastinfosetspecs/geronimo-j2ee-management_1.1_spec/1.20.2_1</bundle>
		<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlsec/1.3.0_1</bundle>
		        <bundle>mvn:commons-pool/commons-pool/1.4</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/xbean/xbean-spring/3.5</bundle>
        <bundle>mvn:org.apache.servicemix.bundles.wss4j/1.5.4_1</bundle>
		activemq/kahadb/5.3.0</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jetty-bundle/6.1.14_1</bundle>
		activemq/activemq-core/5.3.0</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlbeans/2.4.0_1</bundle>
		activemq/activemq-ra/5.3.0</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_1</bundle>
		activemq/activemq-console/5.3.0</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlschema/1.4.2_1</bundle>
		activemq/activemq-pool/5.3.0</bundle>
        <!-- <bundle>mvn:org.apache.servicemix.bundlesactivemq/org.apache.servicemix.bundlesactivemq.antcommands/14.70.0_1<0</bundle> -->
		    </feature>
	
    <feature name="activemq-camel" version="5.3.0">
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jdom/1.1_1</bundle>
		<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.werken-xpath/0.9.4_1</bundle>
		<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.neethi/2.0.4_1</bundle>
		<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera/0.4.0-incubating_1</bundle>
		activemq/activemq-camel/5.3.0</bundle>
    </feature>
	
    <feature name="spring-web">
        <bundle>mvn:org.springframework/spring-web/2.5.6.SEC01</bundle>
        <bundle>mvn:org.springframework.osgi/spring-osgi-web/1.2.0</bundle> 
    </feature>
   
    <feature name="hibernate">
        <bundle>mvn:org.springframework/spring-orm/2.5.6.SEC01</bundle>
        <bundle>mvn:org.springframework/spring-jdbc/2.5.6.SEC01</bundle>
    	<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.junitdom4j/41.6.41_1<2</bundle>
	    	<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/3.0.1_1</bundle>
		antlr/com.springsource.antlr/2.7.7</bundle>
    	<bundle>mvn:org.apachejgroups/com.servicemixspringsource.bundles/org.apache.servicemix.bundles.commons-io/1.3.2_jgroups/2.5.1</bundle>
	    	<bundle>mvn:org.apachejboss.servicemix.specsjavassist/orgcom.apachespringsource.servicemixjavassist/3.specs.javamail-api-1.4/1.2.0<3.0.ga</bundle>
    		<bundle>mvn:org.apachehibernate/com.servicemixspringsource.specs/org.apachehibernate/3.servicemix.specs.jaxws-api-2.1/1.2.0</bundle>
	3.1.GA</bundle>
    </feature>
    
    <feature name="jdbc-driver">
	<bundle>mvn:org.apache.servicemix.specsbundles/org.apache.servicemix.specsbundles.saaj-api-1.3commons-dbcp/1.2.0<2_3</bundle>
	    	<bundle>mvn:orgcom.apachemysql.servicemix.bundlesjdbc/orgcom.apachespringsource.servicemixcom.bundlesmysql.wsdl4jjdbc/5.1.6.1_1<8</bundle>
    </feature>
    
		    <feature name="wicket" version="1.4.7">
    	<bundle>mvn:org.apache.geronimo.specs/geronimo-ws-metadata_2.0_spec/1.1.2</bundle>
		wicket/wicket/1.4.7</bundle>
    	<bundle>mvn:org.apache.cxfwicket/cxfwicket-bundleioc/21.4.2<7</bundle>
	</feature>

	<feature name="web-core">
	    	<bundle>mvn:org.apache.geronimo.specswicket/geronimo-servlet_2.5_specwicket-spring/1.14.2<7</bundle>
		    	<!-- <bundle>mvn:org.apache.servicemix.bundles/wicket/wicket-spring-annot/1.4.7</bundle> -->
    	<bundle>mvn:org.apache.servicemix.bundles.jetty-bundle/6.1.14_1</bundle>
	wicket/wicket-extensions/1.4.7</bundle>
    </feature>

	<feature name="web">
		<feature>web-core</feature>
		<bundle>mvn:org.ops4j.pax.web/pax-web-bundle/0.6.0</bundle>
		<bundle>mvn:org.ops4j.pax.web/pax-web-jsp/0.6.0</bundle>
		<bundle>mvn:org.ops4j.pax.web-extender/pax-web-ex-war/0.5.1</bundle>
		<bundle>mvn:org.ops4j.pax.web-extender/pax-web-ex-whiteboard/0.5.1</bundle>
		<bundle>mvn:org.ops4j.pax.url/pax-url-war/0.4.0</bundle>
		<bundle>mvn:org.apache.servicemix.war/org.apache.servicemix.war.deployer/4.0.0</bundle>
	</feature>
	
	<feature name="spring-web">
	    <bundle>mvn:org.springframework/spring-web/2.5.6</bundle>
        <bundle>mvn:org.springframework.osgi/spring-osgi-web/1.2.0-rc1</bundle> 
	</feature>
	
    <feature name="transaction">
        <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.howl/1.0.1-1_1</bundle>
        <bundle>mvn:org.apache.geronimo.components/geronimo-transaction/2.2-r634076</bundle>
        <bundle>mvn:org.springframework/spring-tx/2.5.6</bundle>
        <bundle>mvn:org.apache.servicemix.transaction/org.apache.servicemix.transaction/1.0.0</bundle>
    </feature>
    
    <feature name="connector">
        <feature>transaction</feature>
        <bundle>mvn:org.apache.geronimo.components/geronimo-connector/2.2-r634076</bundle>
        <bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jencks/2.1_1</bundle>
    </feature>
    
    <feature name="common">
    	<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.1.6_1</bundle>
	<bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/1.2.0</bundle>
	<bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.1/1.2.0</bundle>
	<bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
	<bundle>mvn:commons-lang/commons-lang/2.4</bundle>
	<bundle>mvn:commons-pool/commons-pool/1.4</bundle>
	<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.asm/2.2.3_1</bundle>
    </feature>
    
    <feature name="activemq" version="5.2.0">
    	<feature>connector</feature>
    	<bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spec/1.0.1</bundle>
    	<bundle>mvn:org.apache.xbean/xbean-spring/3.4.3</bundle>
	<bundle>mvn:org.apache.activemq/activemq-core/5.2.0</bundle>
	<bundle>mvn:org.apache.activemq/activemq-ra/5.2.0</bundle>
	<bundle>mvn:org.apache.activemq/activemq-console/5.2.0</bundle>
	<bundle>mvn:org.apache.activemq/activemq-pool/5.2.0</bundle>
	<bundle>mvn:org.apache.servicemix.activemq/org.apache.servicemix.activemq.commands/4.0.0</bundle>
    </feature>
    
    <feature name="hibernate">
        <bundle>mvn:org.springframework/spring-orm/2.5.6</bundle>
        <bundle>mvn:org.springframework/spring-jdbc/2.5.6</bundle>
    	<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6_2-SNAPSHOT</bundle>
    	<bundle>mvn:org.antlr/com.springsource.antlr/2.7.7</bundle>
    	<bundle>mvn:org.jgroups/com.springsource.org.jgroups/2.5.1</bundle>
    	<bundle>mvn:org.jboss.javassist/com.springsource.javassist/3.3.0.ga</bundle>
    	<bundle>mvn:org.hibernate/com.springsource.org.hibernate/3.3.1.GA</bundle>
    </feature>
    
    <feature name="jdbc-driver">
	<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.2.2_3</bundle>
    	<bundle>mvn:com.mysql.jdbc/com.springsource.com.mysql.jdbc/5.1.6</bundle>
    </feature>
    
    <feature name="wicket">
    	<bundle>mvn:org.apache.wicket/wicket/1.3.5</bundle>
    	<bundle>mvn:org.apache.wicket/wicket-ioc/1.3.5</bundle>
    	<bundle>mvn:org.apache.wicket/wicket-spring/1.3.5</bundle>
    	<bundle>mvn:org.apache.wicket/wicket-spring-annot/1.3.5</bundle>
    	<bundle>mvn:org.apache.wicket/wicket-extensions/1.3.5</bundle>
    </feature>
     
</features>

To generate the jar file containing the feature xml file, adapt the pom.xml like this :

...


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.apache.camel.example</groupId>
	<artifactId>reportincident.features</artifactId>
	<packaging>jar</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>Report Incident Project Features</name>

	<build>
		<resources>
			<!-- standard Maven folder -->
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>

		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.3</version>
				<executions>
					<execution>
						<phase>copy-resources</phase>
						<goals>
							<goal>resources</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>
 
     
</features>

To generate the jar file containing the feature xml file, adapt the pom.xml like this :

Code Block
xml
xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.apache.camel.example</groupId>
	<artifactId>reportincident.features</artifactId>
	<packaging>jar</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>Reportincident :: Project Features</name>
	
	<parent>
		<groupId>org.apache.camel.example</groupId>
	    <artifactId>reportincident.parent</artifactId>
	    <version>1.0-SNAPSHOT</version>
	</parent>

	<build>
		<resources>
			<!-- standard Maven folder -->
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>

		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.3</version>
				<executions>
					<execution>
						<phase>copy-resources</phase>
						<goals>
							<goal>resources</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>

During the execution of the following maven command :

Code Block

mvn clean install

maven will put the file reportincident.features-1.0-SNAPSHOT-features.xml in the jar and the jar will be installed in your Maven local repository under the directory {{localMavenRepository/org/apache/camel/example/reportincident.features/1.0-SNAPSHOT

Deploy

The deployment process is very simple and two steps will be necessary :

Step 1 : Copy properties files in etc directory

Copy the files containing your properties file org.apache.camel.example.reportincident.datasource.cfg, ... in the etc directory of Apache Felix Karaf and customize them if required

Step 2 : Edit the file org.apache.felix.karaf.features.cfg

To use the feature file created in the previous section, we must adapt the file org.apache.felix.karaf.features.cfg that you find in the etc directory

Replace the current featureRepositories line with the following :

Code Block

featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.4.0/xml/features,mvn:org.apache.camel.karaf/apache-camel/2.2.0/xml/features,jar:mvn:org.apache.camel.example/reportincident.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml

This line will be processed by PAX Url who will pickup the reportincident.features-1.0-SNAPSHOT-features.xml file from the jar located in the maven repository localMavenRepo/org.apache.camel.example/reportincident.features/1.0-SNAPSHOT

and

replace the existing line containing the featuresBoot parameter

by

Code Block

featuresBoot=spring,spring-dm,camel,camel-bindy,camel-jms,activemq,activemq-camel,http,war,spring-web,camel-cxf,hibernate,jdbc-driver,wicket,reportincident

By adding these two lines, we will configure our Apache Felix Karaf server to install bundles from features defined in the order appearing at the line of featuresBoot

Note

The deployment order of the bundle is critical in an OSGI environement. This is why for the purposes of this project/tutorial we have organised in consequence. If you plan to change something in the application, be aware of that

Warning

The /etc/system.property file must be modified to define the environment variable servicemix.base used by activemq bundle

Add the following line
servicemix.base=root

Test it

Step 1 : launch application

It is time to launch the karaf server and to test if our application works well. If this is not yet done, download Apache Felix Karaf 1.4.0 server and install it. Launch the server by executing the command in the bin folder:

Code Block

c:\apache-felix-karaf-1.4.0\bin>karaf
Info

If this is the first time that Karaf is started, then you will see that a new data folder is created. This directory will contain subfolders :

  • cache : containing the bundlles deployed
  • log : where the log file is updated by the application

Step 2 : Check osgi list

When the following prompt appears on the screen :

Code Block

c:\apache-felix-karaf-1.0.0\bin>karaf
        __ __                  ____
       / //_/____ __________ _/ __/
      / ,<  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

  Apache Felix Karaf (1.4.0)

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

karaf@root>

execute the command :

Code Block

karaf@root:/> osgi:list
Tip

During the first launch of Karaf, it will install all the bundles defined in the features (one by one) in the order defined. 134 bundles must be deployed, so be patient because it can take time depending of your internet connection, cpu, processor of your machine.

but after a few minutes, you must see the following list

Code Block

karaf@root> osgi:list
START LEVEL 100
   ID   State         Blueprint      Spring    Level  Name
[   0] [Active     ] [            ] [       ] [    0] System Bundle (2.0.4)
[   1] [Active     ] [            ] [       ] [    5] OPS4J Pax Url - mvn: (1.1.2)
[   2] [Active     ] [            ] [       ] [    5] OPS4J Pax Url - wrap: (1.1.2)
[   3] [Active     ] [            ] [       ] [    8] OPS4J Pax Logging - API (1.4)
[   4] [Active     ] [            ] [       ] [    8] OPS4J Pax Logging - Service (1.4)
[   5] [Active     ] [            ] [       ] [   10] Apache Felix Configuration Admin Service (1.2.4)
[   6] [Active     ] [            ] [       ] [   10] Apache Felix Preferences Service (1.0.4)
[   7] [Active     ] [            ] [       ] [   11] Apache Felix File Install (2.0.8)
[   8] [Active     ] [Created     ] [       ] [   20] Apache Geronimo Blueprint Bundle (1.0.0)
[   9] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Management (1.4.0)
[  10] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Spring Deployer (1.4.0)
[  11] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Deployer (1.4.0)
[  12] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Various Commands (1.4.0)
[  13] [Active     ] [            ] [       ] [   30] Apache Mina SSHD :: Core (0.3.0)
[  14] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Development Commands (1.4.0)
[  15] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Core (1.4.0)
[  16] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell ConfigAdmin Commands (1.4.0)
[  17] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell PackageAdmin Commands (1.4.0)
[  18] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Blueprint Deployer (1.4.0)
[  19] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: JAAS Modules (1.4.0)
[  20] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Admin Management (1.4.0)
[  21] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell OSGi Commands (1.4.0)
[  22] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: JAAS Config (1.4.0)
[  23] [Active     ] [            ] [       ] [   30] org.osgi.impl.bundle.jmx (4.2.0.200907080519)
[  24] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Command (1.4.0)
[  25] [Active     ] [            ] [       ] [   30] Apache Felix Gogo Shell Runtime (0.2.2)
[  26] [Active     ] [            ] [       ] [   30] Apache MINA Core (2.0.0.RC1)
[  27] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Console (1.4.0)
[  28] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Admin Core (1.4.0)
[  29] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Management (1.4.0)
[  30] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Admin Command (1.4.0)
[  31] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Log Commands (1.4.0)
[  32] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell SSH (1.4.0)
[  33] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: aopalliance-1.0 (1.0.0.3)
[  34] [Active     ] [            ] [       ] [   60] Spring Core (2.5.6.SEC01)
[  35] [Active     ] [            ] [       ] [   60] Spring Beans (2.5.6.SEC01)
[  36] [Active     ] [            ] [       ] [   60] Spring AOP (2.5.6.SEC01)
[  37] [Active     ] [            ] [       ] [   60] Spring Context (2.5.6.SEC01)
[  38] [Active     ] [            ] [       ] [   60] Spring Context Support (2.5.6.SEC01)
[  39] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: ACTIVATION API 1.4 (1.4.0)
[  40] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: JAXB API 2.1 (1.4.0)
[  41] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: STAX API 1.0 (1.4.0)
[  42] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jaxb-impl-2.1.12 (2.1.12.1)
[  43] [Active     ] [            ] [       ] [   60] Commons Management (1.0)
[  44] [Active     ] [            ] [       ] [   60] camel-core (2.2.0)
[  45] [Active     ] [            ] [       ] [   60] Spring Transaction (2.5.6.SEC01)
[  46] [Active     ] [            ] [       ] [   60] geronimo-jta_1.1_spec (1.1.1)
[  47] [Active     ] [            ] [       ] [   60] Commons Pool (1.5.4)
[  48] [Active     ] [            ] [       ] [   60] geronimo-jms_1.1_spec (1.1.1)
[  49] [Active     ] [            ] [       ] [   60] Spring JMS (2.5.6.SEC01)
[  50] [Active     ] [            ] [       ] [   60] camel-jms (2.2.0)
[  51] [Active     ] [            ] [       ] [   60] geronimo-servlet_2.5_spec (1.1.2)
[  52] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jetty-6.1.22 (6.1.22.1)
[  53] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - API (0.7.2)
[  54] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Service SPI (0.7.2)
[  55] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Runtime (0.7.2)
[  56] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Jetty (0.7.2)
[  57] [Active     ] [            ] [       ] [   60] camel-bindy (2.2.0)
[  58] [Active     ] [            ] [       ] [   60] activemq-camel (5.3.0)
[  59] [Active     ] [            ] [Started] [   60] Reportincident :: ActiveMQ Queuing Engine (1.0.0.SNAPSHOT)
[  60] [Active     ] [            ] [Started] [   60] Reportincident :: Camel Queuing Service (1.0.0.SNAPSHOT)
[  61] [Active     ] [            ] [       ] [   60] Reportincident :: Model Bundle (1.0.0.SNAPSHOT)
[  62] [Active     ] [            ] [Started] [   60] Reportincident :: Persistence Bundle (1.0.0.SNAPSHOT)
[  63] [Active     ] [            ] [Started] [   60] Reportincident :: Service Bundle (1.0.0.SNAPSHOT)
[  64] [Active     ] [            ] [       ] [   60] Reportincident :: Webservice Bundle (1.0.0.SNAPSHOT)
[  65] [Active     ] [            ] [Started] [   60] Reportincident :: Routing Bundle (1.0.0.SNAPSHOT)
[  66] [Active     ] [            ] [       ] [   60] Reportincident :: Web Bundle (1.0.0.SNAPSHOT)
[  67] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: commons-dbcp-1.2.2 (1.2.2.3)
[  68] [Active     ] [            ] [       ] [   60] MySQL AB's JDBC Driver for MySQL (5.1.6)
[  69] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: cglib-2.1_3 (2.1.0.3_4)
[  70] [Active     ] [            ] [       ] [   60] spring-osgi-io (1.2.0)
[  71] [Active     ] [            ] [       ] [   60] spring-osgi-core (1.2.0)
[  72] [Active     ] [            ] [       ] [   60] spring-osgi-extender (1.2.0)
[  73] [Active     ] [            ] [       ] [   60] spring-osgi-annotation (1.2.0)
[  74] [Active     ] [Created     ] [       ] [   60] Apache Felix Karaf :: Spring Deployer (1.2.0)
[  75] [Active     ] [            ] [       ] [   60] camel-spring-osgi (2.2.0)
[  76] [Active     ] [            ] [       ] [   60] Spring Web (2.5.6.SEC01)
[  77] [Active     ] [            ] [       ] [   60] spring-osgi-web (1.2.0)
[  78] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jetty-6.1.14 (6.1.14.1)
[  79] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - API (0.7.1)
[  80] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Service SPI (0.7.1)
[  81] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Runtime (0.7.1)
[  82] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Jetty (0.7.1)
[  83] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: asm-2.2.3 (2.2.3.3)
[  84] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jetty-6.1.19 (6.1.19.2)
[  85] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: commons-codec-1.3 (1.3.0.2)
[  86] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jdom-1.1 (1.1.0.2)
[  87] [Active     ] [            ] [       ] [   60] jettison (1.2)
[  88] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: ant-1.7.0 (1.7.0.3)
[  89] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: bcel-5.2 (5.2.0.2)
[  90] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xalan-2.7.1 (2.7.1.2)
[  91] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xercesImpl-2.9.1 (2.9.1.3)
[  92] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xmlbeans-2.4.0 (2.4.0.3)
[  93] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xmlsec-1.4.3 (1.4.3.2)
[  94] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xmlresolver-1.2 (1.2.0.2)
[  95] [Active     ] [            ] [       ] [   60] Woodstox XML-processor (4.0.7)
[  96] [Active     ] [            ] [       ] [   60] Stax2 API (3.0.1)
[  97] [Active     ] [            ] [       ] [   60] XmlSchema (1.4.5)
[  98] [Active     ] [            ] [       ] [   60] Commons Lang (2.4)
[  99] [Active     ] [            ] [       ] [   60] Commons Collections (3.2.1)
[ 100

During the execution of the maven command :

Code Block

mvn clean install

maven will put the file reportincident.features-1.0-SNAPSHOT-features.xml in the jar and the jar will be installed in your Maven local repository under the directory {{localMavenRepository/org/apache/camel/example/reportincident.features/1.0-SNAPSHOT

Deploy

The deployment process is very simple and two steps will be necessary :

Step 1 : Copy properties files in etc directory

Copy the files containing your properties file org.apache.camel.example.reportincident.datasource.cfg, ... in the etc directory of ServiceMix and cujstomize them if required

Step 2 : Edit the file org.apache.servicemix.features.cfg

To use the feature file created in the previous section, we must adapt the file org.apache.servicemix.features.cfg that you find in the etc directory

Replace the current featureRepositories line with the following :

Code Block

featuresRepositories=jar:mvn:org.apache.camel.example/reportincident.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml

This line will be processed by PAX Url who will pickup the reportincident.features-1.0-SNAPSHOT-features.xml file from the jar located in the maven repository localMavenRepo/org.apache.camel.example/reportincident.features/1.0-SNAPSHOT

and

replace the existing line containing the featuresBoot parameter

by

Code Block

featuresBoot=common,transaction,connector,activemq,web-core,web,spring-web,wicket,cxf,cxf-osgi,camel,jdbc-driver,hibernate,reportincident

By adding these two lines, we will configure our ServiceMix OSGI server to install bundles from features defined in the order appearing at the line of featuresBoot

Note

The deployment order of the bundle is critical in an OSGI environement. This is why for the purposes of this project/tutorial we have organised in consequence. If you plan to change something in the application, be aware of that

Test it

Step 1 : launch application

It is time to launch the servicemix server and to test if our application works well. If this is not yet done, download ServiceMix Kernel 1.1.0 server and install it. Launch the server by executing the command in the bin folder:

Code Block

c:\apache-servicemix-kernel-1.1.0\bin>servicemix
Info

If this is the first time that Servicemix is started, then you will see that a new data folder is created. This directory will contain subfolders :

  • cache : containing the bundlles deployed
  • log : where the servicemix.log is updated by the application

Step 2 : Check osgi list

When the following prompt appears on the screen :

Code Block

D:\Dvlpt\Java\workspace-ganymede\esb\apache-servicemix-kernel-1.2.0-SNAPSHOT\bin>servicemix
 ____                  _          __  __ _
/ ___|  ___ _ ____   _(_) ___ ___|  \/  (_)_  __
\___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ /
 ___) |  __/ |   \ V /| | (_|  __/ |  | | |>  <
|____/ \___|_|    \_/ |_|\___\___|_|  |_|_/_/\_\

 ServiceMix Kernel (1.2.0-SNAPSHOT)

Type 'help' for more information.
--------------------------------------------------------------------------------------------
smx@root:/> 

execute the following commands :

Code Block

smx@root:/> osgi
smx@root:osgi> list
Tip

During the first launch of SMX, it will install the bundles. Around 110 bundles have to be installed/deployed, so be patient because it can take time depending of your internet connection, cpu, processor of your machine.

but after a few minutes, you must see the following list

Code Block

smx@root:osgi> list
START LEVEL 100
   ID   State         Spring     Level  Name
[   0] [Active     ] [            ] [       ] [  0] System Bundle (1.5.0.r752991)
[   1] [Active 60] Apache ServiceMix Bundles: antlr-2.7.7 (2.7.7.2)
[ 101] [Active     ] [            ] [       ] [   1060] Apache FelixServiceMix Prefrences ServiceBundles: oro-2.0.8 (12.0.28.3)
[ 102] [Active   2  ] [Active            ] [       ] [   1060] Apache ServiceMix Specs Bundles:: JAXP API  velocity-1.46.2 (1.46.02.SNAPSHOT3)
[ 103]  3[Active     ] [Active            ] [       ] [   1060] geronimo-annotation_1.0_specAxiom API (1.12.18)
[   4104] [Active     ] [            ] [      10 ] [  OSGi R460] CompendiumAxiom BundleAPI (41.12.08)
[ 105] [Active     ] [      5] [Active     ] [       ] [   1060] Apache ServiceMix Bundles: jaxpmail-ri-1.4.21 (1.4.1.2.1)
[ 106]  6[Active     ] [Active            ] [       ] [   1060] Apache FelixServiceMix Configuration Admin Service (1Bundles: neethi-2.0.4 (2.0.4.2)
[   7107] [Active     ] [       ]  [   10] geronimo-servlet_2.5_spec (1.1.2)
[   8] [Active     ] [Started] [   4060] Apache ServiceMix Kernel Bundles:: GShell Core (1.2 abdera-0.4.0-incubating (0.4.0.SNAPSHOTincubating_3)
[   9108] [Active     ] [            ] [    8   ] OPS4J[  Pax Logging60] geronimo- API jaxws_2.1_spec (1.3.0)
[  10109] [Active     ] [            ] [    8   ] OPS4J[  Pax Logging60] - Servicegeronimo-annotation_1.0_spec (1.31.01)
[  11110] [Active     ] [            ] [      5 ] OPS4J Pax Url - wrap: (0.3.3[   60] Apache ServiceMix Specs :: SAAJ API 1.3 (1.4.0)
[  12111] [Active     ] [            ] [    5   ] OPS4J Pax Url - mvn: (0.3.3[   60] Apache ServiceMix Bundles: wsdl4j-1.6.2 (1.6.2.2)
[  13112] [Active     ] [       ] [   30] Apache ServiceMix Kernel :: GShell Features (1.2.0.SNAPSHOT)
[  14    ] [Active      ] [Started] [   3060] Apache ServiceMix KernelSpecs :: GShellJSR311 OSGiAPI Commands1.0 (1.24.0.SNAPSHOT)
[  15113] [Active     ] [            ] [   30] Apache ServiceMix Bundles: mina-1.1.7    ] [   60] geronimo-ws-metadata_2.0_spec (1.1.7.12)
[  16114] [Active     ] [            ] [Started] [   3060] spring-osgi-extender Apache CXF Bundle Jar (12.2.0.rc16)
[  17115] [Active     ] [       ]  [   30] Spring Context (2.5.6)
[  18] [Active     ] [Started] [   3060] Apache ServiceMix Kernel :: GShell PackageAdmin Commands Bundles: commons-io-1.3.2 (1.3.2.0.SNAPSHOT3)
[  19116] [Active     ] [Started] [   30] Apache ServiceMix Kernel :: GShell ConfigAdmin Commands (1.2.0.SNAPSHOT)
[  20] [Active      ] [Started] [   3060] Apache ServiceMix Kernel :: JAAS Config (1camel-cxf (2.2.0.SNAPSHOT)
[  21117] [Active     ] [            ] [    30   ] Apache[  ServiceMix Bundles:60] commonsgeronimo-jexlj2ee-connector_1.15_spec (12.10.0.1)
[ 118] [Active     22] [Active            ] [       ] [   3060] Apache ServiceMix Bundles: commons-httpclient-3.howl-1.0.1-1 (3.1.0.1.1_1)
[ 119] [Active     ] [      23] [Active     ] [       ] [   3060] Spring CoreGeronimo TxManager :: Transaction (2.52.0.6r634076)
[  24120] [Active     ] [            ] [Started] [  30] jmx-impl 60] Apache ServiceMix Transaction (1.0.0.r6125-patched)
[  25121] [Active     ] [       ]  [   30] spring-osgi-io (1.2.0.rc1)
[  26] [Active     ] [       60] [Geronimo TxManager :: 30]Connector jmx (2.1.0.0.r6125-patched3)
[  27122] [Active     ] [       ]  [   30] spring-osgi-core (1.2.0.rc1)
[  28] [Active     ] [Started] [   3060] Apache ServiceMix Kernel :: JAAS Modules (1.2.0.SNAPSHOTJencks (2.2)
[  29123] [Active     ] [            ] [   30    ] Apache[  ServiceMix Bundles:60] commonsgeronimo-vfsj2ee-management_1.01_spec (1.0.0.1)
[  30124] [Active     ] [        ] [   30] Spring Beans (2.5.6)
[  31] [Active     ] [Started] [   3060] Apache ServiceMixCommons Kernel :: GShell AdminPool Bundle (1.2.0.SNAPSHOT4)
[  32125] [Active     ] [       ] [   30] Unnamed - com.google.code.sshd:sshd:bundle:0.1 (0.1)
[  33] [Active     ] [       ] [   3060] Apache ServiceMix Bundles: commons-codec-1.2 (1.2.0.1xbean-spring (3.5)
[  34126] [Active     ] [Started            ] [   30]   Apache ServiceMix] Kernel[ :: GShell Log60] Commandskahadb (15.23.0.SNAPSHOT)
[  35127] [Active     ] [            ] [   30    ] Apache[  ServiceMix Bundles:60] jline-0.9.94activemq-core (05.93.94.10)
[  36128] [Active     ] [            ] [   30    ] Apache[  ServiceMix Bundles:60] aopallianceactivemq-1.0ra (15.03.0.1)
[  37129] [Active     ] [            ] [   30    ] Spring AOP[   60] activemq-console (25.53.60)
[  38130] [Active     ] [            ] [   30    ] Apache[  ServiceMix Bundles:60] cglib-2.1_3activemq-pool (25.13.0.3_2-SNAPSHOT)
[ 131] [Active  39   ] [Active            ] [       ] [   3060] ApacheOPS4J ServiceMixPax Bundles:Web oro-2.0.8- Jsp Support (2.0.87.12)
[  40132] [Active     ] [Started] [   30] Apache ServiceMix Kernel :: Spring Deployer (1.2.0.SNAPSHOT)
[  41] [Active      ] [Started] [   3060] OPS4J ApachePax Web ServiceMix- KernelExtender ::- ManagementWAR (10.7.2.0.SNAPSHOT)
[[ 133] [Active     42] [Active            ] [       ] [   1560] ApacheOPS4J Pax ServiceMixWeb Kernel- ::Extender File- MonitorWhiteboard (10.7.2.0.SNAPSHOT)
[ 134] [Active   43  ] [Active            ] [       ] [   60] OPS4J ApachePax Url ServiceMix- Bundleswar:, jaxb-impl-2.1.6war-i: (21.1.6.12)
[  44135] [Active     ] [ActiveCreated     ] [       ] [   60] Apache ServiceMixFelix SpecsKaraf :: ACTIVATIONWAR APIDeployer (1.4 (1.2.0)
[  45136] [Active     ] [       ] [   60] Apache ServiceMix Specs :: JAXB API 2.1 (1.2.0)
[  46] [Active     ] [       ] [   60] CommonsWicket Collections (31.24.17)
[  47137] [Active     ] [Active            ] [       ] [   60] Wicket IoC Commonscommon Langcode (21.4.7)
[  48138] [Active     ] [Active            ] [       ] [   60] ApacheWicket CommonsSpring PoolIntegration Bundle (1.4.7)
[  49139] [Active     ] [            ] [   60    ] Apache ServiceMix Bundles: asm-2.2.3 (2.2.3.1)
[  50] [Active[   60] Wicket Extensions (1.4.7)
[ 140] [Active     ] [            ] [       ] [   60] geronimo-jta_1.1_spec (1.1.1)
[  51] [ActiveSpring ORM (2.5.6.SEC01)
[ 141] [Active     ] [            ] [       ] [   60] geronimo-j2ee-connector_1.5_specSpring JDBC (2.5.06.0SEC01)
[ 142] [Active  52   ] [Active            ] [       ] [   60] Apache ServiceMix Bundles: howldom4j-1.06.1-1 (1.06.1.1_12)
[  53143] [Active     ] [            ] [     60  ] Geronimo[  TxManager ::60] TransactionANTLR (2.27.0.r6340767)
[ 144] [Active  54   ] [Active            ] [       ] [   60] SpringJGroups TransactionToolkit (2.5.6)
[  551)
[ 145] [Active     ] [            ] [Active      ] [Started] [   60] ApacheJavassist Java ServiceMixProgramming TransactionAssistant (13.3.0.0ga)
[ 146] [Active    56 ] [Active            ] [       ] [   60] GeronimoJBoss TxManager :: ConnectorHibernate Object-Relational Mapper (23.23.01.r634076)
[  57] [ActiveGA)
Warning

If errors happen during installation of the bundles, the list could be not completed. In this is the case, the feature provisioning system has stopped the installation. You have to check the log file of karaf and depending of the error reported, correction made, the installation can be relaunched in the menu 'feature' using the command :

Code Block

karaf@root> features:list
  State     
]
 
[
    Version  
] [
   
60]
 
geronimo-jms_1.1_spec (1.1.1)
 Name
[uninstalled]  
58]
[ 
[Active
     0.0.0] hibernate

karaf@root> features:install hibernate

If a problem occurs with a bundle, you can by example recompile the code, regenerate the jar and update the bundle using the command

Code Block

karaf@root> osgi:update xxx

where xxx corresponds to the bundle to be updated

The features list can also be very helpfull to see which features has been installed

smx@root:osgi> features smx@root:features> list State

[installed  ] [1.4.0       ] http      
Version
       
Name [uninstalled]
  
[
      karaf-1.4.0
.0.0] hibernate smx@root:features> install hibernate

If a problem occurs with a bundle, you can by example recompile the code, regenerate the jar and update the bundle using the command

Code Block

karaf@root> features:list

State         Version        Name  [       ] [   60] Apache ServiceMix Bundles: jencks-2.1 (2.1.0.1)
[  59] [Active     ] [       ] [   60] geronimo-j2ee-management_1.1_spec (1.0.1)
[  60] [Active   Repository
[installed  ] [2.2.0       ] [camel   60] xbean-spring (3.4.3)
[  61] [Active     ] [       ] [repo-0
[installed   60] activemq-core (5[2.2.0)
[    62] [Active  ] camel-core  ] [       ] [   60] activemq-ra (5.2.0)repo-0
[installed  63] [Active2.2.0       ] [camel-spring-osgi       ] [   60] activemq-console (5repo-0
[uninstalled] [2.2.0)
[  64] [Active     ] [camel-spring        ] [   60] activemq-pool (5repo-0
[uninstalled] [2.2.0)
[     65] [Active ] camel-osgi   ] [Started] [   60] Apache ServiceMix Features :: ActiveMQ Commands (4.0.0) repo-0
[uninstalled]  66] [Active[2.2.0       ] [camel-test       ] [   60] Apache ServiceMix Bundles: jetty-6.1.14 (6.1.14.1)repo-0
[installed  67] [Active2.2.0     ] [ ] camel-cxf     ] [   60] OPS4J Pax Web - Web Container (0.6.0)
[  68] [Activerepo-0
[uninstalled] [2.2.0       ] [ camel-cache      ] [   60] OPS4J Pax Web repo- Jsp Support (0.6.0)
[  69uninstalled] [Active2.2.0     ] [ ]  camel-castor    ] [   60] OPS4J Pax Web Extender repo- WAR (0.5.1)
[  70uninstalled] [Active2.2.0     ] [ ] camel-dozer     ] [   60] OPS4J Pax Web Extender repo- Whiteboard (0.5.1)
[  71uninstalled] [Active2.2.0     ] [ ] camel-http     ] [   60] OPS4J Pax Url - war:, war-i: (0.4.0)
[  72] [Activerepo-0
[uninstalled] [2.2.0       ] camel-mina     ] [Started]  [   60] Apache ServiceMix WAR Deployer (4.0.0)repo-0
[uninstalled]  73] [Active[2.2.0       ] [camel-jetty        ] [   60] Spring Web (2.5.6)
[  74] [Active repo-0
[uninstalled] [2.2.0        ] [camel-servlet       ] [   60] spring-osgi-web (1.2.0.rc1)repo-0
[installed  75] [Active2.2.0       ] [camel-jms          ] [   60] Wicket (1.3.5) repo-0
[uninstalled]  76] [Active[2.2.0       ] [camel-amqp       ] [   60] Wicket IoC common code (1.3.5) repo-0
[uninstalled]  77] [Active[2.2.0       ] [camel-atom       ] [   60] Wicket Spring Integration (1.3.5) repo-0
[uninstalled]  78] [Active[2.2.0       ] [camel-bam       ] [   60] Wicket Spring Integration through Annotations (1.3.5) repo-0
[installed  79] [Active2.2.0       ] [camel-bindy       ] [   60] Wicket Extensions (1.3.5)
[  80 repo-0
[uninstalled] [Active2.2.0     ] [ ] camel-cometd     ] [   60] Apache ServiceMix Bundles: FastInfoset-1.2.2 (1.repo-0
[uninstalled] [2.2.1)
[  81] [Active0       ] camel-csv [       ] [   60] Apache ServiceMix Bundles: xmlsecrepo-1.3.0 (1.3.0.1)
[  82] [Active0
[uninstalled] [2.2.0       ] [camel-flatpack       ] [   60] Apache ServiceMix Bundles: wss4j-1.5.4 (1.5.4.1)
[  83] [Activerepo-0
[uninstalled] [2.2.0     ] [ ] camel-freemarker     ] [   60] Apache ServiceMix Bundles: xmlbeans-2.4.0 (2.4.0.1)
[  84] [Activerepo-0
[uninstalled] [2.2.0       ] ]camel-ftp [       ] [   60] Apache ServiceMix Bundles: xmlresolver-1.2 (1repo-0
[uninstalled] [2.2.0.1)
[  85] [Active     ] [camel-guice       ] [   60] Apache ServiceMix Bundles: xmlschema-1.4.2 (1.4.2.1)
[  86] [Active repo-0
[uninstalled] [2.2.0        ] [  camel-groovy     ] [   60] Apache ServiceMix Bundles: antrepo-1.7.0 (1.7.0.1)
[  87] [Active0
[uninstalled] [2.2.0       ] ]camel-hl7 [       ] [   60] Apache ServiceMix Bundles: jdom-1.1 (1.1.0.1)
[  88] [Activerepo-0
[uninstalled] [2.2.0     ] [ ] camel-ibatis     ] [   60] Apache ServiceMix Bundles: werken-xpathrepo-0.9.4 (0.9.4.1)
[  89] [Active
[uninstalled] [2.2.0       ] [camel-irc        ] [   60] Apache ServiceMix Bundles: neethi-2.0.4 (repo-0
[uninstalled] [2.2.0.4.1)
[  90] [Active     ] [camel-jaxb       ] [   60] Apache ServiceMix Bundles: abderarepo-0.4.0-incubating (0.4.0.incubating_1)
[  91] [Active
[uninstalled] [2.2.0       ] camel-jcr [       ] [   60] Apache ServiceMix Bundles: junit-4.4 (4.4.0.1)
[  92] [Activerepo-0
[uninstalled] [2.2.0       ] [camel-jing       ] [   60] Apache ServiceMix Bundles: antlrrepo-3.0.1 (3.0.1.1)
[  93] [Active0
[uninstalled] [2.2.0       ] [camel-jdbc       ] [   60] Apache ServiceMix Bundles: commons-io-1.3.2 (1.3.2.1)
[  94] [Activerepo-0
[uninstalled] [2.2.0       ] camel-josql      ] [       repo-0
[uninstalled] [2.2.0   60] Apache ServiceMix Specs :: JAVAMAIL API 1.4 (1.2.0)
[  95] [Active    ] camel-jpa                repo-0
[uninstalled] [2.2.0       ] camel-jxpath  [   60] Apache ServiceMix Specs :: JAXWS API 2.1 (1.2.0)
[  96] [Active  repo-0
[uninstalled] [2.2.0    ] [  ] camel-juel    ] [   60] Apache ServiceMix Specs :: SAAJ API 1.3 (1 repo-0
[uninstalled] [2.2.0)
[  97] [Active     ] [camel-ldap       ] [   60] Apache ServiceMix Bundles: wsdl4j-1.6.1 (1.6.1.1)
[  98] [Active     ] [repo-0
[uninstalled] [2.2.0       ] camel-mail          ] [   60] geronimo-ws-metadata_2.0_spec (1.1.2)
[  99] [Activerepo-0
[uninstalled] [2.2.0       ] ]camel-msv [       ] [   60] Apache CXF Bundle Jar ( repo-0
[uninstalled] [2.2)
[ 100] [Active.0       ] [Started] [camel-mvel        60] Apache ServiceMix CXF Transport for OSGi (4.0.0)repo-0
[ 101uninstalled] [Active2.2.0       ] [camel-ognl          ] [   60] camel-core (repo-0
[uninstalled] [2.02.0.M1)
[ 102] [Active     ] [camel-printer       ] [   60] camel-spring (repo-0
[uninstalled] [2.02.0.M1)
[ 103] [Active     ] [ camel-protobuf      ] [   60] camel-osgi (repo-0
[uninstalled] [2.02.0.M1)
[ 104] [Active     ] [camel-quartz        ] [   60] camel-bindy (repo-0
[uninstalled] [2.02.0.M1)
[ 105] [Active     ] [camel-restlet        ] [   60repo-0
[uninstalled] Spring JMS ([2.5.6)
[ 106] [Active2.0       ] [camel-rmi           ] [   60] camel-jms (repo-0
[uninstalled] [2.02.0.M1)
[ 107] [Active     ] [camel-rss           ] [   60] camel-cxf (repo-0
[uninstalled] [2.02.0.M1)
[ 108] [Active     ] camel-saxon [        ] [   60] activemq-camel (5repo-0
[uninstalled] [2.2.0)
[ 109] [Active     ] [ camel-scala      ] [   60] Apache ServiceMix Bundles: commons-dbcp-1.2.2 (1.repo-0
[uninstalled] [2.2.3)
[ 110] [Active0       ] camel-script [        ] [   60repo-0
[uninstalled] MySQL AB's JDBC Driver for MySQL (5.1.6)
[ 111] [Active[2.2.0       ] camel-smpp       ] [       repo-0
[uninstalled] [2.2.0   60]   Spring ORM (2.5.6)
[ 112] [Active] camel-snmp       ] [       repo-0
[uninstalled] [2.2.0   60    ] Spring JDBC (2.5.6)
[ 113] [Activecamel-spring-integration repo-0
[uninstalled] [2.2.0       ] [camel-sql        ] [   60] Apache ServiceMix Bundles: dom4j-1.6.1 (1.6.0.SNAPSHOT)
[ 114] [Activerepo-0
[uninstalled] [2.2.0       ] [camel-stream       ] [   60] ANTLR (2.7.7)
[ 115 repo-0
[uninstalled] [Active2.2.0     ] [       ] [camel-string-template   60] JGroups Toolkit (2.5.1)
[ 116] [Active repo-0
[uninstalled] [2.2.0     ] [ ] camel-tagsoup     ] [   60] Javassist Java Programming Assistant (3.3.0.ga)
[ 117] [Active repo-0
[uninstalled] [2.2.0     ] [ ] camel-velocity     ] [   60] JBoss Hibernate Object-Relational Mapper (3.3.1.GA)
[ 134] [Activerepo-0
[uninstalled] [2.2.0       ] [Started] [camel-xmlbeans       60] ActiveMQ Queuing engine (1.0.0.SNAPSHOT)repo-0
[ 135uninstalled] [Active2.2.0       ] [Started] [camel-xmlsecurity    60] Camel Queuing Service (1.0.0.SNAPSHOT)
[ 136] [Activerepo-0
[uninstalled] [2.2.0       ] [camel-xmpp       ] [   60] Report Incident Model Bundle (1.0.0.SNAPSHOT)
[ 137] [Active repo-0
[uninstalled] [2.2.0       ] [Started] [ camel-xstream       60] Report Incident Persistence Bundle (1.0.0.SNAPSHOT) repo-0
[installed 138 ] [Active2.5.6.SEC01 ] spring            ] [Started] [   60] reportincident.service (karaf-1.04.0.SNAPSHOT)
[installed  139] [Active1.2.0       ] [spring-dm       ] [   60] Report Incident Webservice Bundle (karaf-1.4.0
[uninstalled] [1.0.SNAPSHOT)
[ 140] [Active4.0       ] wrapper        ] [Started] [   60] Report Incident Routing Bundle (karaf-1.04.0.SNAPSHOT)
[ 141uninstalled] [Active1.4.0       ] [obr             ] [   60] Report Incident Web Bundle (karaf-1.04.0.SNAPSHOT)
Warning
Code Block

If errors happen during installation of the bundles, the list could be not completed. In this case, the feature provisioning system has stopped the installation. You have to check the log file of servicemix and depending of the error reported, correction made, the installation can be relaunched in the menu 'feature' using the command :

Code Block
Code Block

smx@root:osgi>update xxx

where xxx corresponds to the bundle to be updated

The features list can also be very helpfull to see which features has been installed


smx@root:features> list
  State  
[installed  ] [1.4.0       ] war                      karaf-1.4.0
[uninstalled] [1.4.0       ] webconsole        Version       Namekaraf-1.4.0
[installed  ] [1.4.0       ] ssh   [                   0karaf-1.04.0
[installed  ] hibernate
[installed[1.4.0       ]  [management               0karaf-1.4.0
[installed  ] [1.0-SNAPSHOT] web-core reportincident           repo-0
[installed  ] [1.0.0 [      ] transaction        2.2] cxf
[installed    ]  repo-0
[ installed  ]   0[4.0.0]  common
[installed  ]  [ ] connector    0.0.0] transaction
[installed  ]  [      0.0.0] camel-activemq repo-0
[installed  ] [5.3.0 [      0.0.0] web
[installedactivemq  ]  [               1.0] reportincidentrepo-0
[installed  ] [5.3.0 [      0.0.0] cxf-osgi
[installedactivemq-camel  ]  [      0.0.0] spring-web repo-0
[installed  ] [0.0.0 [      0.0.0] camel-spring
[installedspring-web  ]  [   2.0-M1] camel
[installed  ]  [   repo-0
[installed  ] [0.0.0] camel-core
[installed     ]  [] hibernate     0.0.0] camel-bindy
[installed  ]  [      5.2.0] activemqrepo-0
[installed  ] [0.0.0 [      0.0.0] connector
[installed  ]  [] jdbc-driver             0.0.0] camel-osgi repo-0
[installed  ] [1.4.7 [      0.0.0] wicket
[installed  ]  [      0.0.0] jdbc-driver
[installed  ]  [      repo-0
[uninstalled] [0.0.0] camel-jms
[installed  ]  [  ] http-reportingincident   0.0.0] camel-cxfrepo-0

Step 3 : Incident file

To test the Camel routing, we have to produce an incident file report and put it in the file defined in the from uri of your inittial route. Create a file containing csv lines :

...

Next, open the web page of your application : http://localhost:8080/reportincidentweb/Image Removed

Step 4 : Call a webservice

...

Use the following url from Soapui, to generate the client interface to communicate with the web service : http://localhost:8080/cxf/camel-example/incident?wsdlImage Removed.

Call the web service with the request : http://localhost:8080/cxf/camel-example/incidentImage Removed
and the following SOAP message request by example :

Code Block
xml
xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep="http://reportincident.example.camel.apache.org">
   <soapenv:Header/>
   <soapenv:Body>
      <rep:inputReportIncident>
         <incidentId>000</incidentId>
         <incidentDate>29-04-2009</incidentDate>
         <givenName>Charles</givenName>
         <familyName>Moulliard</familyName>
         <summary>This is an web service report incident</summary>
         <details>This is an web service report incident,This is an web service report incident.</details>
         <email>cmoulliard@gmail.com</email>
         <phone>+222 10 20 30 40</phone>
      </rep:inputReportIncident>
   </soapenv:Body>
</soapenv:Envelope>

Check the Servicemix Karaf log :

log_file_servicemix2.txt

and web screen result : http://localhost:8080/reportincidentweb/Image Removed

Conclusion

Well, this tutorial was a little bit long but we have tried to provide you all the required information to design a real application using Apache Camel, ServiceMixFelix Karaf, OSGI, CXF and Apache Wicket frameworks. We hope that we have reached the goals defined in the introduction and will continue to improve its content based on Apache frameworks evolution. A part which is not covered but we plan to add it in the future concerns the testing/debugging of the application and transactional aspects.

...

...

...

...

  • 2c : web and deployment

#Resources

  • Attachments
    patterns.*part2.zip