0

QUESTION

How can I see the "merged" server.xml that the runtime sees after all relevant config is combined according to Liberty precedence rules?

Background

My project's server.xml has a number of includes and potentially some configDropins files adding to the original server.xml, with build logic copying different sources into place.

server.xml with includes

<server>
    <include location="dev.xml" optional="true"/>
    <include location="common.xml" />
    <!-- ... -->
</server>

configDropins

/target/liberty/wlp/usr/servers/defaultServer/server.xml
/target/liberty/wlp/usr/servers/defaultServer/configDropins/defaults/quick-start-security.xml
/target/liberty/wlp/usr/servers/defaultServer/configDropins/overrides/liberty-plugin-variable-config.xml

Example

E.g. take a config element like applicationMonitor.

<applicationMonitor dropinsEnabled="false" updateTrigger="mbean"/>

If this element appears more than once across the various config files with different attribute values in each, how can I see the final "merged" value?

Scott Kurz
  • 4,985
  • 1
  • 18
  • 40

1 Answers1

1

SOLUTION

Use the config REST endpoint provided by the Liberty restConnector-2.0 feature.

STEPS

  1. Configure the restConnector-2.0 feature.
<server description="my server">
    <featureManager>
        <feature>restConnector-2.0</feature>
    </featureManager>
</server>
  1. Configure administrator access
<server description="my server">
  
  <quickStartSecurity userName="bob" userPassword="bobpassword" />

  <keyStore id="defaultKeyStore" password="keystorePassword"/>

</server description="my server">
  1. Start the server and access the https://<host>:<port>/ibm/api/config endpoint, e.g.: https://localhost:9443/ibm/api/config and login with the configured user:password = bob:bobpassword.

  2. Look at the JSON response, e.g. for applicationMonitor something like:

   {
      "configElementName": "applicationMonitor",
      "dropins": "dropins",
      "dropinsEnabled": false,
      "pollingRate": 500,
      "updateTrigger": "mbean"
   },

More Options

See the restConnector-2.0 feature documentation for additional options.

Further reading

For more information, see the article: https://openliberty.io/docs/latest/validating-server-connections.html

This article also describes how to use the config API to view the values of individual config elements, and also how to do "validation" of certain elements, e.g. a "test connection" of a JDBC dataSource.

Scott Kurz
  • 4,985
  • 1
  • 18
  • 40