Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Database cleanup assistance
We are seeing the following error when the Trash task runs:
java.lang.NullPointerException
at com.liferay.portlet.trash.util.TrashImpl.getMaxAge(TrashImpl.java:225)
at com.liferay.portlet.trash.util.TrashUtil.getMaxAge(TrashUtil.java:80)
at com.liferay.portlet.trash.service.impl.TrashEntryLocalServiceImpl.getMaxAge(TrashEntryLocalServiceImpl.java:391)
......
We know that in the past some direct manipulation was done against the database (running Liferay 5.2.3), we do not know exactly what they did as it pre-dates the current team. The data has since been migrated to Liferay 6.2 EE.
The stack trace is because there is a Group record with a classPk that points to a Layout record that doesn't exist.
Does anyone have any suggestions for how to go about cleaning this up?
java.lang.NullPointerException
at com.liferay.portlet.trash.util.TrashImpl.getMaxAge(TrashImpl.java:225)
at com.liferay.portlet.trash.util.TrashUtil.getMaxAge(TrashUtil.java:80)
at com.liferay.portlet.trash.service.impl.TrashEntryLocalServiceImpl.getMaxAge(TrashEntryLocalServiceImpl.java:391)
......
We know that in the past some direct manipulation was done against the database (running Liferay 5.2.3), we do not know exactly what they did as it pre-dates the current team. The data has since been migrated to Liferay 6.2 EE.
The stack trace is because there is a Group record with a classPk that points to a Layout record that doesn't exist.
Does anyone have any suggestions for how to go about cleaning this up?
Fix the invalid layout record.
Basically the line of code is this:
Not sure what the NPE is coming from, group can't be null or it would have triggered an NPE somewhere else, PropsKeys.TRASH_ENTRIES_MAX_AGE is a string constant, the PropsValues one is pulled from the properties, but it uses code which is typically hardened against NPEs.
Basically the line of code is this:
int trashEntriesMaxAge = PrefsPropsUtil.getInteger(
group.getCompanyId(), PropsKeys.TRASH_ENTRIES_MAX_AGE,
PropsValues.TRASH_ENTRIES_MAX_AGE);
Not sure what the NPE is coming from, group can't be null or it would have triggered an NPE somewhere else, PropsKeys.TRASH_ENTRIES_MAX_AGE is a string constant, the PropsValues one is pulled from the properties, but it uses code which is typically hardened against NPEs.
Thank you for the quick response.
This line:
group = group.getParentGroup();
is where the group ends up null.
This is caused by the parentGroupId of the original group being set to 0. This happened when the migration process was unable to find the missing layout.
This line:
group = group.getParentGroup();
is where the group ends up null.
This is caused by the parentGroupId of the original group being set to 0. This happened when the migration process was unable to find the missing layout.
if (group.isLayout()) {
group = group.getParentGroup();
}
int trashEntriesMaxAge = PrefsPropsUtil.getInteger(
group.getCompanyId(), PropsKeys.TRASH_ENTRIES_MAX_AGE,
PropsValues.TRASH_ENTRIES_MAX_AGE);
Community
Company
Feedback