Export of site fails with NoSuchTemplateException

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:
    1. Please download the appropriate version of DXP bundle by going to the Liferay Help Center Homepage, select the DXP product -> Downloads tab -> Latest Release
    2. Start the bundle
    3. Export the Global site's web content portlet
    4. Then import it in your environment's Global site's web content section.
    5. 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

 

这篇文章有帮助吗?
0 人中有 0 人觉得有帮助