Issue
- When I make some configuration change in instance settings and click save, the page breaks (menus are gone) and the changes are not stored.
- In the logs I see a stacktrace is thrown, with parts like these:
ERROR [http-nio-8080-exec-4][PortletServlet:112] javax.portlet.PortletException: com.liferay.portal.kernel.exception.ModelListenerException: java.lang.NullPointerException
javax.portlet.PortletException: com.liferay.portal.kernel.exception.ModelListenerException: java.lang.NullPointerException
at com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand.processAction(BaseMVCActionCommand.java:69)
Caused by: java.lang.NullPointerException
at com.liferay.portal.model.impl.UserImpl.getGroupId(UserImpl.java:512)
at com.liferay.calendar.internal.model.listener.UserModelListener.onAfterUpdate(UserModelListener.java:68)
... 231 more
Environment
- DXP 7.1
- DXP 7.2
Resolution
- This is caused by an invalid row in the calendarresource table, pertaining to the hidden default user liferay creates when it first starts up. We currently do not know how this row was inserted. According to the current knowledge, normal portal operation and functionality cannot cause the creation of such a row.
- The row can be found with a select like this:
SELECT * FROM CalendarResource
WHERE classNameId = (SELECT classNameId FROM ClassName_ WHERE value = 'com.liferay.portal.kernel.model.User')
AND classPK = (SELECT userId FROM User_ WHERE emailAddress = 'default@liferay.com');
- The solution is to remove that row, with a Groovy script like this:
import com.liferay.calendar.service.CalendarResourceLocalServiceUtil;
CalendarResourceLocalServiceUtil.deleteCalendarResource(10101275);
where 10101275 should be replaced with whatever is the calendarResourceId returned by the SELECT query above. Make sure to try it first on a pre-production environment, and also make a database backup before, to stay on the safe side. If you are unsure or encounter any difficulties why applying this solution, please open a ticket with Support and refer to this article.