Skip to end of metadata
Go to start of metadata
Old Documentation
This documentation applies to AS 7.0 only and has been superceded by documentation that can be found
in the JBoss OSGi Documentation Pages.

OSGi functionality in JBoss AS 7 is provided through the OSGi subsystem.

More information on the OSGi component in JBoss AS 7 can be found on the JBoss OSGi project pages.

The OSGi subsystem can be configured in its section in the JBoss AS 7 configuration XML file.

The following items can be configured:

Subsystem Attributes

Attribute Description
activation When set to lazy the OSGi subsystem will not get activated until the first OSGi bundle deployment. When set to eager the OSGi subsystem will be activated at startup of the Application Server.

Configuration Admin

The OSGi Configuration Admin Service (CAS) is a standard service aimed at configuring OSGi-based applications. Many OSGi applications use the CAS to configure themselves.

The OSGi subsystem configuration allows for the specification of CAS configuration information, to configure bundles written for this specification (chapter 104 in the OSGi 4.2 Compendium Specification)

To add CAS configuration information, add <configuration> tags to the OSGi subsystem configuration. For example, the following is used to configure the context root where the Felix Web Console appears:

Configuration information consists of a <configuration> tag specifying a PID (Persistent Identifier) attribute which identifies the system to be configured. The configuration tag can contain any number of embedded <property> tags which hold the configuration information for this PID.

Framework Properties

OSGi Framework properties are specified as embedded <property> elements in the <properties> tag.

The following properties are specified:

Property Description
org.jboss.osgi.system.modules A comma-separated list of module identifiers. Each system module is added as a dependency to the OSGi framework module. The packages from these system modules can be made visible as framework system packages by adding them to the org.osgi.framework.system.packages.extra property.
org.osgi.framework.system.packages.extra Extra packages which the system bundle must export from the current execution environment.
org.osgi.framework.startlevel.beginning The beginning start level of the OSGi Framework. This also influences which modules are pre-loaded. See the modules section.

Additional OSGi Framework properties can be specified. For more information on OSGi Framework properties see the OSGi 4.2 Core Specification.

Modules

JBoss AS 7 comes with a repository of modules and OSGi bundles that can be automatically loaded at startup. JBoss-Modules compliant modules can be found in the modules/ directory and OSGi bundles can be found in the bundles/ directory. In the <modules> section of the XML configuration both JBoss-Modules as well as OSGi Bundles can be specified.

OSGi Bundles can also be started automatically at startup. This is specified with the startlevel attribute. The default start level of the OSGi Framework is 1. To enable additional functionality in the OSGi Framework, increase the org.osgi.framework.startlevel.beginning framework property.

Note that these modules don't trigger the activation of the OSGi subsystem. Once the subsystem is activated as described above, these modules and bundles will be automatically loaded and optionally started.

The following modules and bundles are listed in the default configuration.

Module Identifier Description
javaee.api Provides JavaEE APIs.
org.apache.aries.jmx Provides JMX support to OSGi as described in chapter 124 of the OSGi 4.2 Enterprise Specification. For more information see Using JMX below.
org.apache.aries.util Needed by the Aries JMX bundle.
org.apache.felix.configadmin An implementation of the OSGi Configuration Admin specificaton. Chapter 104 in the OSGi 4.2 Compendium Specification.
org.apache.felix.eventadmin An implementation of the OSGi Event Admin specification. Chapter 113 in the OSGi 4.2 Compendium Specification.
org.apache.felix.log An implementation of the OSGi Log Service specification. Chapter 101 in the OSGi 4.2 Compendium Specification.
org.apache.felix.metatype An implementation of the OSGi Metatype Service specification. Chapter 105 in the OSGi 4.2 Compendium Specification.
org.apache.felix.webconsole The Felix Web Console. For more information see Using the Felix Web Console below.
org.jboss.as.osgi.configadmin Component providing the OSGi Configuration Admin Service with information from the OSGi subsystem configuration.
org.jboss.logging The JBoss Logging Framework.
org.jboss.osgi.blueprint An implementation of the OSGi Blueprint Specification. Blueprint is a component model and IoC specification for OSGi which significantly simplifies the use of OSGi services. It can be found in chapter 121 in the OSGi 4.2 Enterprise Specification.
org.jboss.osgi.http An implementation of the OSGi Http Service. Chapter 102 in the OSGi 4.2 Compendium Specification. The port used by this implementation is set by default to <socket-binding name="osgi-http" port="8090"/> in the socket-binding-group.
org.jboss.osgi.jmx Enhanced JMX API, the MBeans can be found under jboss.osgi.
org.jboss.osgi.logging Sends log messages sent to the OSGi Log Service to JBoss Logging.
org.jboss.osgi.webapp OSGi Support for Web Apps, as described in chapter 128 in the OSGi 4.2 Compendium Specification.
org.jboss.osgi.webconsole Customizations of the Felix Web Console.
org.jboss.osgi.xerces An implementation of the OSGi XML Parser specification. Chapter 702 in the OSGi 4.2 Compendium Specification.
org.osgi.compendium A bundle providing the APIs defined by the OSGi Compendium Specification.

Using the Felix Web Console

For fine-grained management of the OSGi Framework, the Apache Felix Web Console can be used. This web console is shipped as part of JBoss AS 7 and is specifically aimed at fine-grained control of the OSGi Framework.

The Web Console is not enabled by default. The relevant modules are marked as having startlevel=2, so to enable the web console set the initial framework start level to 2 or higher:

By default the console appears on http://localhost:8090/jboss-osgi with as username and password admin/admin. This can be configured through the OSGi Configuration Admin Service configuration.

Start JBoss AS 7 and make sure the OSGi Framework is active; the framework can be activated by deploying an OSGi bundle into JBoss AS 7 or by setting its activation mode to eager.

Then open a web browser and access: http://localhost:8090/jboss-osgi. A log-in dialog appears. Enter the password configured or the default username and password: admin/admin and the web console will appear:

Using JMX

The OSGi Framework exposes a number of JMX MBeans that enable remote control of the framework. Both the MBeans that are defined in chapter 124 of the OSGi 4.2 Enterprise Specification as well as JBoss-extended MBeans are available.

The JMX support is not enabled by default. The relevant modules are marked as having startlevel=2, so to enable JMX set the initial framework start level to 2 or higher:

Start JBoss AS 7 and make sure the OSGi Framework is active; the framework can be activated by deploying an OSGi bundle into JBoss AS 7 or by setting its activation mode to eager.

The JMX functionality can now be accessed through a JMX console, for instance jconsole which ships with the JDK:

Connect using the Remote Process URL service:jmx:rmi:///jndi/rmi://127.0.0.1:1090/jmxrmi. (You can also connect directly to the Local Process, the one that starts with jboss-modules.jar -mp ...)

When the connection is established navigate to the MBeans tab to interact with the OSGi MBeans.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.