vogella.de

Follow me on twitter
About Lars Vogel

Run OSGi bundles on the SpringSource dm Server - Tutorial

Lars Vogel

Version 0.3

10.12.2008

Revision History
Revision 0.1 - 0.219.04.2008Lars Vogel
First rought versions
Revision 0.310.12.2008Lars Vogel
Included the deployment of OSGi bundles.

Abstract

This article describes how to install and run OSGI bundles on the Spring dm server. It first describes how to install and start the SpringSource dm Server. It then describes the installation of the Eclipse plugins to make the usage of the Spring dm server easier with Eclipse and describes how to setup the dm server in Eclipse. The article describes then how to connect to the Spring dm OSGi console. Finally the deployment of an OSGi bundle to the Spring dm server is explained.


Table of Contents

1. Spring source dm server
2. Server Installation
2.1. Download
2.2. Starting the server
2.3. Stopping the server
3. Eclipse Client Installation
4. Eclipse Server configuration
5. Connecting to the OSGi console
6. Deploying an OSGi bundle
7. Thank you
8. Questions and Discussion
9. Links and Literature
9.1. Source Code
9.2. Spring Links

1. Spring source dm server

Spring source dm server is a module-based Java application server based on Apache Tomcat and OSGi-based technologies. It consists out of:

  • The Spring Framework

  • Apache Tomcat

  • OSGi (using Equinox as implementation)

  • Spring Dynamic Modules (Spring DM)

  • SpringSource Tool Suite (Eclipse plugins)

The Spring source dm server is in the following article called "server".

2. Server Installation

2.1. Download

Download the server from http://www.springsource.com/download/dmserver

Download the binary version and extract to a place on your harddrive, e.g. to the directory C:\Program Files\springsource-dm-server.

2.2. Starting the server

To start the application server select the bin directory and double-click on startup.bat.

To test if the server is running select the following URL http://localhost:8080/. The following screen should be displayed

To start the admin console click on the link "admin console". The default user is "admin" with the password "springsource".

Tip

To change the default port on which the spring source application server is listing change servletContainer.config in the directory config. Replace the port for the HTTP connector.

Tip

The default user and password is stored in the file tomcat-users.xml in the folder /config/servlet

2.3. Stopping the server

To shutdown the Spring Source Application Server use Control + C to stop it.

3. Eclipse Client Installation

For an explanation of the Eclipse update manager please see here: See Using the Eclipse Update Manager

Using the Eclipse update manager install the Java EE Developer Tools from the Eclipse 3.4 distribution.

We will use the Spring IDE and Source Source Application Platform tools for Eclipse to develop for the the server.

Install the Spring IDE from http://springide.org/updatesite/ using the Eclipse Update Manager. Required is only the Core package.

Install the SpringSource Application Platform Tools 1.0.0 from http://static.springsource.com/projects/sts-dm-server/update/ using the Eclipse Update Manager. Required is only the Core package.

4. Eclipse Server configuration

Select the Server-> Servers view, right mouse click on it and select New ->Server.

Maintain the following.

Press finish.

5. Connecting to the OSGi console

Spring dm starts also a OSGi console which by default runs on port 2401. Use for example the program "putty" to connect the OSGi console via telnet.

6. Deploying an OSGi bundle

You can deploy an OSGi bundle by putting it into the "pickup" directory

For an example how develop a plugin see OSGi development with Eclipse Equinox. Create a plugin and export it to the pickup directory. Spring dm server constantly checks the directory for new plugins. Your plugins will then be copied into the work directory.

Tip

The OSGi dependencies in the pickup directory are not automatically resolved. So you have to manually assure you copy the OSGi bundles in the correct order to the folder (or that you start the server several times to pickup the bundles).

After a while you should see the plugins in the OSGi console.

You see then the output of your bundles in the directory "serviceability/trace/de.vogella.osgi.firstbundle-1" in the file "trace.log".

Tip

It is also possible to deploy via the webinterface of the admin console in case you don't have direct access to the directory.

7. Thank you

Thank you for practicing with this tutorial.

I maintain this tutorial in my private time. If you like the information please help me by donating or by recommending this tutorial to other people.

8. Questions and Discussion

Before posting questions, please see the vogella FAQ . If you have questions or find an error in this article please use the www.vogella.de Google Group . I have created a short list how to create good questions which might also help you. .

9. Links and Literature

9.1. Source Code

http://www.vogella.de/code/codejava.html Source Code of Examples

9.2. Spring Links

http://www.springframework.org/ Homepage of the Spring Framework

http://forum.springframework.org/ Spring Discussion Forum

http://www.springsource.com Homepage of the Spring Source Application Server

http://www.springsource.com/repository/app/ SpringSource Enterprise Bundle Repository - Provides OSGi bundles for the most commonly used Open Source projects