Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-89191

NoSuchBackgroundTaskException possible when exporting layouts

    Details

    • Fix Priority:
      3

      Description

      With the change from warn to error in LPS-88526, two tests in CompanyLocalServiceTest are now failing:
       
      CompanyLocalServiceTest.testAddAndDeleteCompanyWithLayoutSetPrototype
      CompanyLocalServiceTest.testAddAndDeleteCompanyWithLayoutSetPrototypeLinkedUserGroup

      This is due to the following stack trace:

      Caused by:
       [exec] org.jboss.arquillian.test.spi.ArquillianProxyException: com.liferay.portal.background.task.exception.NoSuchBackgroundTaskException : No BackgroundTask exists with the primary key 48722 [Proxied because : Original exception caused: class java.lang.ClassNotFoundException: com.liferay.portal.background.task.exception.NoSuchBackgroundTaskException]
       [exec] at com.liferay.portal.background.task.service.persistence.impl.BackgroundTaskPersistenceImpl.findByPrimaryKey(BackgroundTaskPersistenceImpl.java:9388)

      Sample full log featuring this issue can be found here.

      The exception can be traced back to LayoutExportController.doExport():

       

      if (BackgroundTaskThreadLocal.hasBackgroundTask()) {
       BackgroundTask backgroundTask =
       _backgroundTaskLocalService.getBackgroundTask(
       BackgroundTaskThreadLocal.getBackgroundTaskId());
      serviceContext.setUserId(backgroundTask.getUserId());
       }
      

       

       

      Reproduction Steps:

      1. Revert the commit ignoring the tests mentioned above. Master commit is: 2ef77e4
      2. Run the tests. I've been able to consistently reproduce using ci:test:relevant, but not when running tests locally.

      Expected Results: Tests pass.

      Actual Results: Tests fail due to stack trace mentioned above.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  1 week, 2 days ago

                  Packages

                  Version Package