OSGi Integration

22 Jul 2015 - 07:34 | Version 9 | | , , ,

The Atomikos OSGi bundle

The Atomikos Transaction Manager can be used in 2 different ways:
  1. If you start the Atomikos OSGi bundle, an implementation of javax.transaction.TransactionManager and javax.transaction.UserTransaction will be registered in the OSGi registry. You”ll be able to do a lookup as requested.
  2. If you don't start the Atomikos OSGi bundle, you'll be free to instantiate the Transaction Manager by yourself pretty much like you would do outside the OSGi world (see Spring sample and/or JTA sample).

Running the example(s)


  • Knowledge of OSGi
  • Knowledge of Pax Exam, the test framework for OSGi.

For the sake of simplicity, the demo relies on an embedded container from Pax Exam. Exam

Setting up your environment

Import the OSGI sample in an IDE that supports maven (all maven IDE have maven support). For Eclipse users, you should be able to see something like this:

Eclipse navigator.png

Note for TransactionsEssentials users : please remove service-tracker-osgi-example-db-axt and service-tracker-osgi-tests-axt modules as they rely on modules that are not available in the central maven repo (see "modules" tag in the service-tracker submodule).

Pax Exam requires your files to be installed in your local maven repo. You need to invoke "mvn clean install" on the "osgi" folder to do that.

Running the TransactionsEssentials demo

  1. Go to service-tracker-osgi-tests module.
  2. Select com.atomikos.osgi.sample.OSGiUnitTest
  3. Run as Java application.
  4. An OSGi container starts a basic OSGi sample. Open http://localhost:8080/ and play with it.

Running the ExtremeTransactions demo

  1. Go to service-tracker-osgi-tests-axt module.
  2. Select com.atomikos.osgi.sample.OSGiContainer
  3. Run as Java application.
  4. Append to the JVM parameters:
    -Dcom.atomikos.icatch.license_folder=<a folder containing a license> 
  5. Re-run the Application.
  6. An OSGi container starts a basic OSGi sample. Open http://localhost:8080/ and play with it.


The config file target/classes/META-INF/maven/dependencies.properties is used by Pax Exam to resolve the right versions of maven modules. If you encounter an error message : "Could not resolve version. Did you configure the plugin in your maven project? Or maybe you did not run the maven build and you are using an IDE?" simply run "mvn compile" on service-tracker-osgi-tests (or service-tracker-osgi-tests-axt).

Contact Us

Atomikos Corporate Headquarters
Hoveniersstraat, 39/1, 2800
Mechelen, Belgium

E info@atomikos.com
E sales@atomikos.com
T +3215613055

Subscribe to our newsletter

Never miss an update

Copyright 2015 Atomikos BVBA