Issue
- We want to export our site into a LAR file, but it fails with the below error on the UI:
-
An unexpected error occurred with the publication process. Please check your portal and publishing configuration.
The Web Content Article: Article1 has missing reference(s) that could not be found during the process.
-
- The below exception is shown in the server logs:
-
Caused by: com.liferay.dynamic.data.mapping.exception.NoSuchTemplateException: No DDMTemplate exists with the template key BASIC-WEB-CONTENT in the ancestor groups at
com.liferay.dynamic.data.mapping.service.impl.DDMTemplateLocalServiceImpl.getTemplate(DDMTemplateLocalServiceImpl.java:670) at
com.liferay.journal.internal.exportimport.data.handler.JournalArticleStagedModelDataHandler.doExportStagedModel(JournalArticleStagedModelDataHandler.java:405) at
com.liferay.journal.internal.exportimport.data.handler.JournalArticleStagedModelDataHandler.doExportStagedModel(JournalArticleStagedModelDataHandler.java:106) at
com.liferay.exportimport.kernel.lar.BaseStagedModelDataHandler.exportStagedModel(BaseStagedModelDataHandler.java:102)
-
Environment
- Liferay DXP 7.0+
Resolution
- The attached exception usually appears when the template related to the web content is not found, in this case, it's the default Basic Web Content template from the Global site
- Normally on the UI, you can't delete a structure or template that has at least one web content associated to it, an error message will say:
Error:The template cannot be deleted because it is required by one or more template links.
- However, it can happen by an accidental API call or deleting it directly from the database (Direct database modifications are not supported)
- Verify the issue by checking your database's
ddmtemplate
table and see if there is a record with the 'BASIC-WEB-CONTENT'
templateKey - If not, then you will need to restore it with a workaround to override the reference checking:
- Please download the appropriate version of DXP bundle by going to the Liferay Help Center Homepage, select the DXP product -> Downloads tab -> Latest Release
- Start the bundle
- Export the Global site's web content portlet
- Then import it in your environment's Global site's web content section.
- After that, you will be able to export your site
Additional Information
- The restored template has a different unique key and it isn't associated with Article1, therefore you will be able to delete it from the UI without any error messages.
- If you create new basic web contents, the template will be protected again against deleting it from the UI