Staging publish fails after migration with an ORMException or StaleObjectStateException

Issue

  • After migrating the Liferay DXP 7.3 environment, the publication process of publishing from the staging server to the live server fails due to an ORMException or a StaleObjectStateException.
  • The new staging environment database was setup by copying over the old staging environment database.
  • The new live environment database was setup by copying over the old staging environment database.
  • The following error occurs when publishing to live:
The publication process did not start due to validation errors.
Invocation failed due to com.liferay.exportimport.kernel.lar.PortletDataException
2022-04-12 23:15:08.899 ERROR [liferay/background_task-4][BackgroundTaskMessageListener:182] Unable to execute background task
com.liferay.portal.kernel.exception.PortalException: Invocation failed due to com.liferay.exportimport.kernel.lar.PortletDataException

 

Environment

  • Liferay DXP 7.3

 

Resolution

  • This exception usually happens when multiple threads (or even multiple servers) work with the same data, it is possible for one of them to attempt to update a 'stale' object and report a StaleObjectStateException.
  • This issue may be caused if the same database is used for both the new staging and production environments. Doing this may introduce a scenario where entities with matching UUIDs and GroupIds between the new staging and production environments would be encountered, resulting in the StaleObjectStateException.
  • To resolve this, create a clean database for the remote Live environment, instead of copying the database from the staging environment. Afterwards, configure Remote staging to publish to the Live site, and then run an initial publish from the Staging site to the Remote Live site. This will copy all of the data from the Staging site to the Remote Live site and should allow publishes to proceed without error.
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0