JBoss Community Archive (Read Only)

JBoss OSGi

Application Server Integration

Overview

The JBoss OSGi framework is fully integrated into the WildFly Application Server. OSGi bundles can be deployed like any other deployment that is supported by WildFly. Hot deployment is supported by dropping an OSGi bundle into the 'deployments' folder. Management is supported through the Command Line Console or the web-based Management Console.

OSGi components can interact with non OSGi services that are natively provided by WildFly. This includes, but is not limited to, the Transaction Service and Naming Service (JNDI).

Standard OSGi Config Admin functionality is supported and integrated with the WildFly domain management layer.

By default the OSGi subsystem is activated on-demand and not part of the standard configuration. When configured and when there is an OSGi bundle deployment the subsystem activates and the respective OSGi services become available.

Configuration

The OSGi subsystem is configured like any other subsystem in the standalone/domain XML descriptor. The configuration options are:

  • Subsystem Activation - By default the OSGi subsystem is activated on-demand. The activation attribute can be set to 'eager' to initialize the subsystem on server startup.

  • Framework Properties - OSGi supports the notion of framework properties. Property values are of type string. A typical configuration includes a set of packages that are provided by the server directly. Please refer to the OSGi core specification for a list of standard OSGi properties.

  • Module Dependencies - The Framework can export packages from server system modules. The property 'org.jboss.osgi.system.modules.extra' contains a list of module identifiers that are setup as dependencies of the OSGi Framework.

  • Capabilities - OSGi bundles can be installed by providing coordinates to the OSGi Repository. Supported coordinates include but are not limited to Maven coordinates and module identifiers.

  • Config Admin properties - Supported are multiple configurations identified by persistent id (PID). Each configuration may contain multiple configuration key/value pairs.Below is a sample configuration for the OSGi subsystem

<subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy">
  <properties>
    <property name="org.jboss.osgi.system.modules.extra">org.apache.log4j</property>
    <property name="org.osgi.framework.system.packages.extra">org.apache.log4j;version=1.2</property>
    <property name="org.osgi.framework.startlevel.beginning">1</property>
  </properties>
  <capabilities>
    <capability name="javax.servlet.api:v25"/>
    <capability name="javax.transaction.api"/>
    <capability name="org.apache.felix.log" startlevel="1"/>
    <capability name="org.jboss.osgi.logging" startlevel="1"/>
    <capability name="org.apache.felix.configadmin" startlevel="1"/>
    <capability name="org.jboss.as.osgi.configadmin" startlevel="1"/>
  </capabilities>
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:configadmin:1.0">
  <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
     <property name="manager.root">jboss-osgi</property>
  </configuration>
</subsystem>

For more details on WildFly configuration see WildFly8 Documentation.

Features

The current JBoss OSGi feature set in AS includes

  • Blueprint Container Support - The OSGi Blueprint Container allows bundles to contain standard blueprint descriptors, which can be used to create or consume OSGi services. Blueprint components consume OSGi services via injection.

  • Hot Deployment - Scans the deployments folder for new or removed bundles.

  • HttpService and WebApp Support - HttpService and WebApp support is provided by Pax Web.

  • JNDI Support - Components can access the JNDI InitialContext as a service from the registry.

  • JTA Support - Components can interact with the JTA TransactionManager and UserTransaction service.

  • Logging System - The logging bridge writes OSGi Log Service LogEntries to the server log file.

  • Repository Support - The OSGi repository can be used to provision the subsystem.

  • XML Parser Support - The Runtime comes with an implementation of an XMLParserActivator which provides access to a SAXParserFactory and DocumentBuilderFactory.

Compatibility Matrix

 

WildFly-8.0.0.Alpha2

JBOSGi-2.0.0

yes

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 11:34:32 UTC, last content change 2013-06-25 12:34:09 UTC.