Initial Provisioning and Startup

We got a Launch

The most complicated tasks getting Sling or any Sling application up and running is launching the framework and providing the initial installation. To simplify these tasks, great efforts have been taken. The result is a Standalone Java Application - the Sling App - and a Web Application - the Sling Servlet - with embedded libraries and a core set of bundles and a mechanism to provide initial configuration and installation. The following description applies to both the standalone application and the web application.

When Sling is first started the following steps are executed:

Initial Bundle Installation by the sling-assembly Bundle

When the sling-assembly bundle is started it registers a FrameworkEventListener which justs listens for the FRAMEWORK_STARTED event. When this event comes in, the framework is up and running, the sling-assembly bundle will look at the Framework properties to see, whether any bundles need to be installed. This is done along the lines of the following pseudo code:

{{{String startLevelList = bundleContext.getProperty( "sling.install.bundles" ) for ( each startLevel in startLevelList ) do


for ( each bundle installed ) do



Given the following properties

{{{sling.install.bundles = 1, 10, 20 sling.install.1 =, \

sling.install.10 =[1,2) sling.install.20 =}}}

These bundles will be installed:



Start Level

>= 0.1.0


>= 0.1.0


Any Version with Major Version 1


Any Version



  1. The Sling application takes care of constructing the sling.install.bundles property from the sling.install.<n> properties found from the different property sources loaded before launching the framework. The sling.install.bundles property needs only be manually created in case the Sling Servlet is not used to launch the OSGi framework for Sling.

  2. Any sling.install.<n> property whose start level value <n> is not listed in the sling.install.bundles property is ignored.

  3. The sling.install.<n> properties are comma-separated lists of bundle specifications where each entry is a tuple of a bundle symbolic name and an optional version range specification (see section 3.2.5, Version Ranges, in the OSGi Service Platform Core Specification). If no version range (or single version) is specified for an entry, any version is applicable.

  4. The bundles listed in the sling.install.<n> properties are simple bundles from the point of view of initial installation. If any of the bundles happen to be an Assembly Bundle (see Assembly: Bundling Bundles) the Assembly Manager will take care of that bundle after the bundle has been installed.

Important Properties

To recapitulate here is a list of Framework properties used for initial provisioning:




A comma-separated list of OSGi Bundle Repository URLs. This property is required to access the OSGi Bundle Repository to install the bundles listed in the sling.install.<n> properties. See the org.apache.felix.bundlerepository Bundle documentation for more information on this property.


A comma-separated list of start level numbers referring to sling.install.<n> properties listing bundles to install. If this property is empty or missing, nothing will be installed.


A comma-separated list of bundle specifications consisting of the (required) bundle symbolic name and an (optional) version range specification separated by colon. Any sling.install.<n> property whose start level value <n> is not listed in the sling.install.bundles, property is ignored.

Using the Sling Standalone Application

The Sling Standalone Application is available as an executable JAR file and may be started by just specifying a simple command line:

java -jar sling-app.jar

This causes Sling to start up as described above. The configuration built into the Sling Standalone Application causes the Apache Felix http.jetty bundle to be installed to run an embedded Servlet Container backing the OSGi HTTPService implementation used to provide the Sling Management Console.

Using the Sling Web Application

Launching Sling in a servlet container is equally simple as using the standalone application: Grab the sling-servlet web application and deploy it into your favourite servlet container.

ApacheSling/SlingInitialStartup (last edited 2009-09-20 23:45:07 by localhost)