Skip to content

pluginUtility merge throws NullPointerException when input plugin-cfg.xml was generated with paused httpEndpoint listeners #35767

Description

@dhenriques

Describe the bug
pluginUtility merge throws a NullPointerException when one of the input plugin-cfg.xml files
was generated while the server's httpEndpoint listeners were paused. When listeners are paused,
PluginGenerator writes a comment indicating the endpoint could not be found and skips the
<ServerCluster> element, but still emits <UriGroup> and <Route> unconditionally. During a
subsequent merge, PluginMergeToolImpl$PluginInfo.<init> performs a hashtable lookup for the
ServerCluster by name, receives null (because no <ServerCluster> exists in the XML), and
throws a NullPointerException.

java.lang.RuntimeException: java.lang.NullPointerException
	at com.ibm.ws.http.plugin.merge.internal.PluginMergeToolImpl.merge(PluginMergeToolImpl.java:776)
	at com.ibm.ws.webserver.plugin.utility.tasks.MergePluginFilesTask.merge(MergePluginFilesTask.java:204)
	at com.ibm.ws.webserver.plugin.utility.tasks.MergePluginFilesTask.mergePluginFilesFromList(MergePluginFilesTask.java:138)
	at com.ibm.ws.webserver.plugin.utility.tasks.MergePluginFilesTask.execute(MergePluginFilesTask.java:66)
	at com.ibm.ws.webserver.plugin.utility.WebServerPluginUtility.runProgram(WebServerPluginUtility.java:103)
	at com.ibm.ws.webserver.plugin.utility.WebServerPluginUtility.main(WebServerPluginUtility.java:146)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:572)
	at com.ibm.ws.kernel.boot.cmdline.UtilityMain.internal_main(UtilityMain.java:175)
	at com.ibm.ws.kernel.boot.cmdline.UtilityMain.main(UtilityMain.java:55)
	at com.ibm.ws.kernel.boot.cmdline.Main.main(Main.java:54)
Caused by: java.lang.NullPointerException
	at com.ibm.ws.http.plugin.merge.internal.PluginMergeToolImpl$PluginInfo.<init>(PluginMergeToolImpl.java:1093)
	at com.ibm.ws.http.plugin.merge.internal.PluginMergeToolImpl.loadData(PluginMergeToolImpl.java:570)
	at com.ibm.ws.http.plugin.merge.internal.PluginMergeToolImpl.merge(PluginMergeToolImpl.java:774)
	... 12 more

Steps to Reproduce

  1. Configure a server with webServerPluginConfig-1.0 and an httpEndpoint.
  2. Start the server, then pause the httpEndpoint listeners.
  3. While listeners are paused, trigger plugin config generation (via pluginUtility generate or
    auto-generation). This produces a plugin-cfg.xml containing <UriGroup> and <Route> but
    no <ServerCluster> element, and the comment:
    <!-- The configured endpoint could not be found. httpEndpointRef=defaultHttpEndpoint-->
    (Note: Liberty generates this comment with a leading space inside the <!--.)
  4. Run pluginUtility merge with the paused-endpoint file as one of the inputs:
    pluginUtility merge \
      --sourcePath=srv01-plugin-cfg.xml,srv02-plugin-cfg-paused-endpoint.xml \
      --targetPath=merged-out.xml
    
  5. Observe NullPointerException as shown above.

The problematic input file has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<Config ASDisableNagle="false" AcceptAllContent="false" ...>
   <!-- The configured endpoint could not be found. httpEndpointRef=defaultHttpEndpoint-->
   <VirtualHostGroup Name="default_host">
      <VirtualHost Name="*:9080"/>
      <VirtualHost Name="*:9443"/>
   </VirtualHostGroup>
   <UriGroup Name="default_host_srv02_default_node_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/myapp/*"/>
   </UriGroup>
   <Route ServerCluster="srv02_default_node_Cluster"
          UriGroup="default_host_srv02_default_node_Cluster_URIs"
          VirtualHostGroup="default_host"/>
</Config>

Expected behavior
pluginUtility merge should handle an input plugin-cfg.xml with no <ServerCluster> element
gracefully. Skipping that server's entries with a descriptive informational message, rather than
throwing an unhandled NullPointerException and aborting the entire merge.

Diagnostic information:

  • OpenLiberty Version: All
  • Affected feature(s): pluginUtility merge
  • Java Version: N/A
  • server.xml configuration: N/A

Additional context
Workaround: Resume listeners, regenerate plugin-cfg.xml, then re-run the merge.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions