Issue
-
The "Resource" option (Control Panel → Configuration → Server Administration → Resource) is blank due to which "Execute Reindex all searches" is not possible and the below error is observed on the server console.
ERROR [default task-98][IncludeTag:128] Current URL /group/control_panel/manage?p_p_id=com_liferay_server_admin_web_portlet_ServerAdminPortlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&_com_liferay_server_admin_web_portlet_ServerAdminPortlet_mvcRenderCommandName=%2Fserver_admin%2Fview&_com_liferay_server_admin_web_portlet_ServerAdminPortlet_tabs1=resources&_com_liferay_server_admin_web_portlet_ServerAdminPortlet_tabs2= generates exception: java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.kernel.backgroundtask.display.BaseBackgroundTaskDisplay.getBackgroundTaskStatusAttributeLong(BaseBackgroundTaskDisplay.java:133)
at com.liferay.portal.search.internal.background.task.display.ReindexBackgroundTaskDisplay.getPercentage(ReindexBackgroundTaskDisplay.java:37)
at com.liferay.portal.kernel.backgroundtask.display.BaseBackgroundTaskDisplay.hasPercentage(BaseBackgroundTaskDisplay.java:77)
at org.apache.jsp.resources_jsp._jspService(resources_jsp:900)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
Environment
- Liferay DXP 7.0
Resolution
-
"Resource" option will show blank when there is some data present in the lock_ and backgroundtask table related to reindexing and clearing the same would help to access the Resource option.
-
Steps to clear the data present in both tables:
Go to Control Panel > Configurations > Server Administration > Script, paste the below groovy script one by one and execute.
a) Remove the reindex lock entry using the following groovy script:
Replace the lockId with the respective Id present in the database.
com.liferay.portal.lock.service.LockLocalServiceUtil.deleteLock(long lockId)
out.println(Deleted Lock Entry);
b) Remove the reindex BackgroundTask entry using following groovy script:
com.liferay.portal.background.task.service.BackgroundTaskLocalServiceUtil.deleteBackgroundTask(long backgroundTaskId)
out.println(Deleted BackgroundTask Entry);Replace the backgroundTaskId with the respective Id present in the database.
Additional information
Important Note: Taking a complete back up of the environment before doing any changes would help if anything unexpected happens.