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
- Configure a server with
webServerPluginConfig-1.0 and an httpEndpoint.
- Start the server, then pause the
httpEndpoint listeners.
- 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 <!--.)
- 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
- 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.
Describe the bug
pluginUtility mergethrows aNullPointerExceptionwhen one of the inputplugin-cfg.xmlfileswas generated while the server's
httpEndpointlisteners were paused. When listeners are paused,PluginGeneratorwrites a comment indicating the endpoint could not be found and skips the<ServerCluster>element, but still emits<UriGroup>and<Route>unconditionally. During asubsequent merge,
PluginMergeToolImpl$PluginInfo.<init>performs a hashtable lookup for theServerClusterby name, receivesnull(because no<ServerCluster>exists in the XML), andthrows a
NullPointerException.Steps to Reproduce
webServerPluginConfig-1.0and anhttpEndpoint.httpEndpointlisteners.pluginUtility generateorauto-generation). This produces a
plugin-cfg.xmlcontaining<UriGroup>and<Route>butno
<ServerCluster>element, and the comment:<!-- The configured endpoint could not be found. httpEndpointRef=defaultHttpEndpoint--><!--.)pluginUtility mergewith the paused-endpoint file as one of the inputs:NullPointerExceptionas shown above.The problematic input file has the following structure:
Expected behavior
pluginUtility mergeshould handle an inputplugin-cfg.xmlwith no<ServerCluster>elementgracefully. Skipping that server's entries with a descriptive informational message, rather than
throwing an unhandled
NullPointerExceptionand aborting the entire merge.Diagnostic information:
Additional context
Workaround: Resume listeners, regenerate
plugin-cfg.xml, then re-run the merge.