Edit | Attach | New | Raw | Delete | History | Print | Tools

OSGi Integration

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)

Pre-requisites

  • 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. The Pax Exam 2.x site

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> 
  1. Re-run the Application.
  2. An OSGi container starts a basic OSGi sample. Open http://localhost:8080/ and play with it.

Troubleshooting

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

Attach
png version 1 uploaded by PascalLeclercq on 14 Dec 2013 - 10:39
 
spacer
Copyright © 2014 Atomikos BVBA. Transaction Management for Extreme Transaction Processing and SOA Environments serving ISV, Commercial, OEM and Open Source Markets
Site map RSS ATOM