Administer Liberty manually

We can administer Liberty from the command prompt, configure it with web server plug-ins, and capture its status. We can package a Liberty server configuration along with the applications that it runs, for distribution to colleagues, or installation on other systems. If available, we can use the Equinox OSGi console to aid with debugging.

The server.xml file is the primary configuration file for the server. We can edit this file, and the files it includes, in a text editor. We can also change the location of the server.xml file. However, for most configurations we do not need to do this.

The bootstrap.properties file is used to specify properties that need to be available before the main configuration is processed. If we update the bootstrap.properties file, we must restart the server for the changes to take effect.

Note that we need to escape specific XML characters such as & (&amp;) and < (&lt;) in Liberty configuration files, such as the server.xml file, because Liberty does not automatically escape these characters.


Example

All the elements that can be configured in the server.xml file, and the files it includes, are described in Liberty features. However, the only required element is a server definition:

    <server/>

Beyond this server definition, we only specify overrides and additions to the default configuration values. For example, for transactions started on this server, we can set the maximum time allowed for each of the transactions to complete:

    <transaction totalTranLifetimeTimeout="30s"/>

Some attributes can have multiple values. For example, we use a list of values to define the features to be provided by the server:

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

See also Add and remove Liberty features. Where multiple instances of a resource type can be configured, for example applications or data sources, we need only provide the attributes that are unique for the resource. We can let the other attributes use the default values, or override them as needed. Therefore the contents of the server.xml file can be brief. For example, here is a complete server configuration to run a web application:

    <server>
         <featureManager>
     <feature>servlet_3.0</feature>
         </featureManager>
         <application name="snoop" location="/mywebapps/snoop" id="snoop" type="war"/>
    </server>

For detailed information about specific aspects of server configuration, see the subtopics.