From Opentaps Wiki
Jump to navigationJump to search

This page provides information about projects at:


What is opentaps-osgi?

We aim to migrate ofbiz and opentaps to a more modern architecture based on:

  • OSGi
  • BPM
  • ESB
  • SCA

It appears that many open source products have been migrated to OSGi. To take full advantage of these products would be desirable to have opentaps and ofbiz restructured as OSGi modules.

Also migration to OSGi enables better architecture and more agile development. I make these statements based on information available on Internet.

In current build the following features are deployed and illustrated:

  • Eclipse Equinox OSGi
  • Spring DM (Dynamic Modules for OSGi development) and Spring Core
  • Tomcat
  • full maven build
  • Eclipse PDE development
  • OSGi Platform maven project build
  • OSGi Extension Projects: log4j configuration, catalina configuration, catalina.start.osgi configuration
  • Sample OSGi Service using Spring DM
  • Sample Web Application that uses the service above

Get Started Quickly

This quick start section is based on ( ) article.

To get you started please take the following steps:

Get your environment ready

If you use eclipse, you can use the following tools:

Cannot find a solution satisfying the following requirements org.eclipse.ui [3.4.2.M20090204-0800].

Then just get the Maven Integration package and Maven SCM Handler for Subclipse. This problem is discussed on m2eclipse-users mailing list

  • java sdk 1.6.0_14

Alternatively, you can download subversion and maven and do this manually from the command line.

Checkout the code

If you are using eclipse:

  • start eclipse and create a new workspace
  • open SVN Repository Exploring perspective
  • Add SVN Repository: svn://
  • File -> Import -> Maven -> Checkout as Maven project from SCM. Use the parameters:
SCM: svn
URL: svn://
  • click Finish button. This will start the import from SVN, which could take a while.

After the import is finished switch to JEE perspective; you should see the following projects:


The projects are already connected to svn

Or, from the commandline:
$ svn co svn:// 

Build the Projects

From eclipse:

  • open opentaps-erp-crm
  • right click on pom.xml and select Run As Maven build ...
  • On the "Edit Configuration" screen, enter clean compile package install for Goals
  • click Apply then Run buttons
  • the first time the build will take long time as it downloads all dependencies from Internet
  • after BUILD SUCCESSFUL message on console select all projects and refresh them to be in synch with the build
  • in the problem window eclipse reports errors that will be fixed as soon as we configure the environment

From the commandline:

First you need to build the "reverser" sample application, which you can do by:

$ cd opentaps-erp-crm/sample/reverser/
$ mvn clean
$ mvn install

This will cause "reverser" to be packaged in your user's .m2/ directory.

Then, go back to the opentaps-erp-crm directory and use maven again:

$ cd opentaps-erp-crm
$ mvn clean
$ mvn compile
$ mvn package
$ mvn install

Configure the OSGi Environment

We need to install the OSGi Platform in PDE.

  • Window -> Preferences -> Plug-in Development -> Target Platform click Add... button
  • Nothing: Start with empty target definition the click Next button
  • click Add button to add a new location
  • select Installation then click Next
  • location: ${workspace_loc}/opentaps-erp-crm/platform/target/platform and click Next
  • You should see a list of 49 plug-ins that are loaded from platform project; click Finish and Finish
  • Select New Target Platform check box and click Apply button then OK button
  • Now in the Problems window all compilation errors should be gone; there are some XML errors that are not important

Run the Platform

  • click on Run Configurations... drop down menu
  • select OSGi Framework and click New
  • Name: opentaps-osgi
  • there are 5 workspace projects and 49 Target Platform plug-ins selected
  • click Validate Bundles button and there should be no problems found (make sure all bundles are selected)
  • select the start level 5 for org.springframework.osgi.web.extender; this ensures that the extender starts after Tomcat is started (the default start level is 4)
  • click Run button and watch the console window for logs
  • focus on console window and type ss to see the list of active bundles (notice catalina, reverser and reverser-client)
  • type status to see more comprehensive information
  • in browser go to http://localhost:8888/reverser-client/
  • enter a string and click Reverse String button
  • it displays the reversed string (also watch the console window)
  • click on browser back button and enter a new string

From commandline:

First start the osgi console:

$ cd opentaps-erp-crm
$ cd platform/target/platform
$ java -jar org.eclipse.osgi- -console

From the console, you can always get a list of the available commands with:

osgi> help

Now you can load your bundles. To load bundles from files, you would need the full path, like this:

osgi> install file:///Users/sichen/IdeaProjects/osgi/opentaps-erp-crm/platform/target/platform/org.springframework.osgi.web.extender-1.1.3.RELEASE.jar
Bundle id is 6

You need to load all the jars in your opentaps-erp-crm/platform/target/platform/ directory with install, plus the following files, again with the full path:

osgi> install file:///Users/sichen/IdeaProjects/osgi/opentaps-erp-crm/sample/reverser/target/org.opentaps.osgi.sample.reverser-0.0.1-SNAPSHOT.jar
osgi> install file:///Users/sichen/IdeaProjects/osgi/opentaps-erp-crm/sample/reverser-client.war

Then you need to start all the bundles with the start command:

osgi> start 6

osgi> start 7

You just need to start them once. Next time you start the console, they should be started already.

To set the start level:

osgi> setbsl 5 6
Bundle 6 Start Level = 5

Software Maintenance

Change the reverser OSGi Service

  • type ss in console window and note the bundle numbers for reverser and reverser-client bundles (4 and 25 in my current run)
  • in reverser project go and modify reverse method in org.springframework.osgi.sample.service.impl.StringReverserImpl

return " >>> " + reveresed;

  • save the file
  • notice that the web application did not pick the change yet (try to reverse more strings)
  • in console window type "refresh 4" where 4 in my case is the bundle number for reverser OSGi service
  • try to reverse more strings and notice that the message on screen reflects your change

Change the reverser-client Web Application

  • do a change in file reverser-client.war\src\main\webapp\index.jsp
  • please note that the change is not activated yet
  • right click on reverser-client.war/pom.xml and select Run As... -> Maven Build ...
  • Goals: clean compile package install
  • click Apply and Run buttons
  • in osgi console window type "refresh 25" where 25 in my case is the bundle number for reverser-client web application
  • note that your change is now reflected on page in browser (refresh the page as it may be cached)


  • we have a full OSGi developmet environment working
  • the roundtrip for sofware maintenance changes is very short as we need to refresh only the component we changed (we do not need to restart the whole platform)
  • we have a solid maven build
  • it works for me and I did not encountered any problems so far
  • I am ready to move forward