Feature management

Liberty features are the units of functionality by which we control the pieces of the runtime environment loaded into a particular server. Use server.xml to declare which features to load. The set of features is enclosed within the <featureManager element, and each feature within the <feature> subelement. For example:

    <server>
      <featureManager>
        <feature>servlet-3.0</feature>
        <feature>localConnector-1.0</feature>
      </featureManager>
    </server>

Some features include other features within them. The same feature can be included in one or more other features. At run time, the feature manager computes the combined list of content required to support the requested set of features.


Dynamic changes to feature configuration

After changing the feature configuration, the feature manager recalculates the list of required bundles, stops and uninstalls those bundles that are no longer required, and installs and starts any additions. Therefore, all features are designed to cope with other features being dynamically added or removed.


Singleton Features

With the delivery of the first set of features for Java EE 7, there are now two versions of the same feature: servlet-3.0 and servlet-3.1. Unlike other application servers, we can choose which version of this feature to use in a server configuration.

  • servlet-3.0 preserves behavior for existing applications
  • servlet-3.1 provides new capabilities for new or modified applications

No additional configuration properties are required to control differences between the two versions.

The servlet feature is a singleton feature, which means we can configure only one version for use in a server. If we have applications that need different versions of the servlet feature, we must deploy them in different servers. Many other features include the servlet feature as a dependency. In the Liberty product, these features have been updated to work with either version. This ensures we can configure a complete stack of features when we use servlet-3.1, but features from other sources might not have been updated to tolerate servlet-3.1. To enable features to tolerate servlet-3.1, modify the feature manifest as follows:

    Subsystem-Content: com.ibm.websphere.appserver.servlet-3.0; ibm.tolerates:="3.1"; type="osgi.subsystem.feature"

If the server configuration includes multiple versions of a singleton feature, either through direct configuration in the server.xml file, or through feature dependencies, that configuration is in error and neither version of that feature is loaded. This error results in a message similar to the following:

    [ERROR ] CWWKF0033E: The singleton features servlet-3.1 and servlet-3.0 cannot be loaded at the same time. The configured features servlet-3.1 and servlet-3.0 include one or more features that cause the conflict.

To resolve this problem, ensure that the configured features all specify, or tolerate, the same version of that singleton feature. If we have hard requirements on both feature versions, we must move some of the applications to a different server.


Superseded features

If a feature is superseded, a new feature or a combination of features might provide an advantage over the superseded feature. For example, new, finer-grained features might be used in place of the superseded one to reduce the server footprint by excluding content that might not be necessary. The new feature or features might not completely replace the function of the superseded feature, so evaluate the new feature before implementing. Superseded features remain completely supported and valid for use in the configuration.