Legacy Knowledge Base
Published Jun. 30, 2025

NoSuchFileEntryException when updating web content with images in a task executor

Written By

Jose Bodega

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When updating web content within a task executor, if the web content structure includes an image field (fileEntry), the update JournalArticle updateArticle(article.getUserId(), article.getGroupId(), article.getFolderId(), article.getArticleId(),article.getVersion(), content, serviceContext) process fails.
  • The failure occurs during the web content validation process when retrieving the associated FileEntry. The underlying issue is that CompanyThreadLocal.getCompanyId() returns 0 within the task executor's context, preventing the system from identifying the correct company and retrieving the FileEntry.
com.liferay.document.library.kernel.exception.NoSuchFileEntryException
com.liferay.exportimport.kernel.exception.ExportImportContentValidationException: com.liferay.document.library.kernel.exception.NoSuchFileEntryException
at com.liferay.exportimport.internal.exportimport.content.processor.DLReferencesExportImportContentProcessor._validateDLReferences(DLReferencesExportImportContentProcessor.java:913)

Environment

  • Liferay DXP 2024.Q1.2+

Resolution

  • To resolve this issue, explicitly set the company ID in the task executor's thread. You can obtain the company ID from the JournalArticle object itself. Here's an example of how to do this within the doExecute method of your task executor:
    @Override
    public void doExecute(DispatchTrigger dispatchTrigger, DispatchTaskExecutorOutput dispatchTaskExecutorOutput) throws PortalException {
    JournalArticle article = ...; // Get your JournalArticle object
    CompanyThreadLocal.setCompanyId(article.getCompanyId());

    try {
    // Perform web content update operations here
    } catch (Exception e) {
    log.error(e);
    }
    }

 

NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.

Additional Information

  • Task executors run in a background thread and do not have this information readily available. Therefore, you must set it manually.

 

 

Did this article resolve your issue ?

Legacy Knowledge Base