Issue while connecting the elasticsearch via config file

Issue

  • The following errors are coming in the Liferay console while connecting the elastic search with the help of the config file.
    ERROR [liferay/monitoring-3][ParallelDestination:59] Unable to process message {destinationName=liferay/monitoring, response=null, responseDestinationName=null, responseId=null, payload=[{displayName=Sign In, portletId=com_liferay_login_web_portlet_LoginPortlet, requestType=ACTION, {attributes=null, companyId=20096, groupId=20119, description=null, duration=0, name=com_liferay_login_web_portlet_LoginPortlet, namespace=com.liferay.monitoring.Portlet, requestStatus=null, stopWatch=0:00:01.590, timeout=0, user=null}}, {referer=http://localhost:8080/client, remoteAddr=127.0.0.1, requestURL=, statusCode=0, userAgent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36, {attributes=null, companyId=20096, groupId=20119, description=null, duration=1604, name=/c/portal/layout, namespace=com.liferay.monitoring.Portal, requestStatus=ERROR, stopWatch=0:00:01.604, timeout=-1, user=null}}, {referer=http://localhost:8080/client, remoteAddr=127.0.0.1, requestURL=, statusCode=0, userAgent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36, {attributes=null, companyId=20096, groupId=0, description=null, duration=1647, name=/web/guest/home, namespace=com.liferay.monitoring.Portal, requestStatus=ERROR, stopWatch=0:00:01.647, timeout=-1, user=null}}], values={defaultLocale=en_US, companyId=20096, groupId=0, principalName=20099, permissionChecker=com.liferay.portal.kernel.util.TransientValue@5597a3e1, siteDefaultLocale=en_US, themeDisplayLocale=en_US}}
    com.liferay.portal.kernel.messaging.MessageListenerException: java.lang.NullPointerException
    at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:41) ~[portal-kernel.jar:?]
    at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74) ~[portal-kernel.jar:?]
    at com.liferay.portal.messaging.internal.ParallelDestination$1.run(ParallelDestination.java:56) [bundleFile:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_341]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_341]
    at java.lang.Thread.run(Thread.java:750) [?:1.8.0_341]
    Caused by: java.lang.NullPointerException

    at com.liferay.portal.monitoring.internal.statistics.portlet.PortletStatistics.processDataSample(PortletStatistics.java:112) ~[?:?]
    at com.liferay.portal.monitoring.internal.statistics.portlet.CompanyStatistics.processDataSample(CompanyStatistics.java:209) ~[?:?]
    at com.liferay.portal.monitoring.internal.statistics.portlet.ServerStatistics.processDataSample(ServerStatistics.java:118) ~[?:?]
    at com.liferay.portal.monitoring.internal.statistics.portlet.ServerStatistics.processDataSample(ServerStatistics.java:36) ~[?:?]
    at com.liferay.portal.monitoring.internal.messaging.MonitoringMessageListener.processDataSample(MonitoringMessageListener.java:89) ~[?:?]
    at com.liferay.portal.monitoring.internal.messaging.MonitoringMessageListener.doReceive(MonitoringMessageListener.java:131) ~[?:?]
    at com.liferay.portal.kernel.messaging.BaseMessageListener.doReceive(BaseMessageListener.java:48) ~[portal-kernel.jar:?]
    at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:34) ~[portal-kernel.jar:?]
    ... 5 more

Environment

  • Liferay DXP 7.4
  • Elasticsearch version 7.17.9

Resolution

  • The 'NullPointerExceptions' are coming from the `_truststorePassword.toCharArray()` method from this line, the value is null because the exported config does not contain this value.
  •  To resolve the issue, the user should add the passwords to the configuration file before placing it into the OSGi/configs folder.
  • Note: User should add `password=` with their Elasticsearch user's password value when the Authentication Enabled option is turned on and `truststorePassword=` when SSL certs are in used for encryption.

Additional Information

  • The further explanation of the reported issue is that the password values are not saved in the CONFIGURATION_ table, which is why they are not exported in the .config file. The reason behind this is that due to security concerns, passwords must not be stored in config files. Hence, it is suggested to configure them via the control panel (UI) since the passwords are masked.
Was this article helpful?
0 out of 2 found this helpful