Lean OSGi Launch Configurations with Jetty

osgi Lean OSGi Launch Configurations with JettyOver the last years I have seen many OSGi project, and while I am pretty happy with most of them there is a tendency to oversized launch configurations. Keeping the launch configs lean is not easy because the automatic dependency resolver can not always pick the smallest set possible. And maybe even worse it is not always obvious which bundles you need to select to make a configuration complete.

I recently developed a small mobile app for iOS and Android with Tabris and RAP and want to share my way of creating a minimal launch config with you.

There are basically 3 categories of bundles in the launch configuration that my app relies on which I use as a “mind hook”:

1. OSGi and Eclipse Code Bundles
2. Bundles for the embedded Jetty server
3. Bundles for the Remote Application Platform (RAP)

So this is how my launch configuration looks like:

1. OSGi and Eclipse Core

org.eclipse.osgi (Level:-1, Auto:true)
org.eclipse.equinox.ds (Level:1, Auto:true)
org.eclipse.osgi.services
org.eclipse.equinox.console
org.apache.felix.gogo.command
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
org.eclipse.equinox.util
org.eclipse.equinox.http.servlet

org.eclipse.equinox.common (Level:2, Auto:true)
org.eclipse.core.commands

2. Jetty Webserver

javax.servlet
org.eclipse.equinox.http.jetty
org.eclipse.jetty.continuation
org.eclipse.jetty.http
org.eclipse.jetty.io
org.eclipse.jetty.security
org.eclipse.jetty.server
org.eclipse.jetty.servlet
org.eclipse.jetty.util

3. Remote Application Platform (RAP)

org.eclipse.rap.rwt
org.eclipse.rap.rwt.osgi
org.eclipse.rap.jface
com.eclipsesource.tabris (optional bundle to enable native mobile apps)

Configuration Arguments

Program arguments:

-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl en -consoleLog -console -clean

VM arguments:

-Declipse.ignoreApp=true
-Dosgi.noShutdown=true
-Dorg.osgi.service.http.port=9090
-Dorg.eclipse.equinox.http.jetty.context.sessioninactiveinterval=0
-Xmx700m

Semi-automatic Bundle Selection

Select the following bundle and “Add Required Bundles” to obtain a working Jetty:

org.eclipse.equinox.http.jetty

For a minimal RAP you only need:

org.eclipse.rap.rwt.osgi
org.eclipse.equinox.ds

Don’t forget to “Add Required Bundles”

If you would like to use the Felix OSGi Shell you have to add the “-console” Program Argument and select all Bundles starting with:

org.apache.felix.gogo.*

Please note:
1. You should not forget to add your own project(s) to your launch configuration!
2. Setting sessioninactiveinterval to 0 forces sessions to never time out. This can be handy for debugging purposes.
3. At the RAP Developer’s Guide you find a detailed listing of all RAP related bundles.

If you have feedback or something to add, please feel free to leave a comment below.

Comments are closed.

No responses yet

Written by . Published in Categories: EclipseSource News, Planet Eclipse, Planet OSGi

Published:
Jan 28th, 2013
Follow:

Twitter LinkedIn Google+ GitHub