Issue
- You might encounter an issue when upgrading from 7.2 to 7.4 where the upgrade step for module com.liferay.dynamic.data.mapping.service fails due to a NoSuchGroupException:
2024-05-22 13:18:39.512 INFO [main][UpgradeProcess:137] Failed upgrade process com.liferay.dynamic.data.mapping.internal.upgrade.v4_0_0.DDMStructureUpgradeProcess in 5505 ms
2024-05-22 13:18:39.521 ERROR [main][UpgradeExecutor:333] Failed upgrade process for module com.liferay.dynamic.data.mapping.service
com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.exception.NoSuchGroupException: No Group exists with the primary key XXXXXX
at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:128) ~[portal-kernel.jar:?]
at com.liferay.portal.upgrade.internal.executor.UpgradeExecutor._executeUpgradeInfos(UpgradeExecutor.java:202) ~[?:?]
at com.liferay.portal.upgrade.internal.executor.UpgradeExecutor.executeUpgradeInfos(UpgradeExecutor.java:124) ~[?:?]
at com.liferay.portal.upgrade.internal.executor.UpgradeExecutor.execute(UpgradeExecutor.java:85) ~[?:?]
...
Caused by: com.liferay.portal.kernel.exception.NoSuchGroupException: No Group exists with the primary key XXXXXX
at com.liferay.portal.service.persistence.impl.GroupPersistenceImpl.findByPrimaryKey(GroupPersistenceImpl.java:14166) ~[portal-impl.jar:?]
at com.liferay.portal.service.persistence.impl.GroupPersistenceImpl.findByPrimaryKey(GroupPersistenceImpl.java:14182) ~[portal-impl.jar:?]
at com.liferay.portal.service.impl.GroupLocalServiceImpl.getGroup(GroupLocalServiceImpl.java:1695) ~[portal-impl.jar:?]
at jdk.internal.reflect.GeneratedMethodAccessor222.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
... - The reason behind this is that you probably have some orphaned data in your DB which needs to be cleaned up
Environment
- Liferay DXP 7.2
- Liferay DXP 7.4+
Resolution
- Run the attached groovy script to clean up the orphaned data
- Make sure to modify the 14th row based on the comment above it, and the 22nd row based on your own groupids