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

Web content summaries cannot be displayed in search after journal-service redeployment

    Details

      Description

      After redeploying the journal-service module, the summary of any web content (with cacheable DDM template) will not be displayed anymore in search results.

      This happens because the display object of any web content (with cacheable DDM template) fails to be created by JournalContentImpl.getArticleDisplay(). JournalContentImpl tries to cache the new article display in Ehcache, but the key for caching is an instance JournalContentKey, and this class removed and readded to the classpath in the redeployment.

      Steps to reproduce

      1. Create a new web content with the following data:
        • title is "Journal Article Title;"
        • summary is "Journal Article Summary;" and
        • content is "Journal Article Content."
      2. In the terminal, execute touch $LIFERAY_HOME/osgi/modules/com.liferay.journal.service.jar.
      3. Go to http://localhost:8080
      4. Search for "summary."

      Expected results:

      • There will be one search result.
      • The result will display the title "Journal Article Title."
      • The result will display the summary "Journal Article Summary."

      Actual results:

      • There is one search result.
      • The result displays the title "Journal Article Title."
      • The result *does not display* the summary "Journal Article Summary."

      Screenshots

      1. Expected result
      2. Actual result

      An integration test that reproduces the problem

      This is especially problematic for integration tests. Once the first rendering is done, the next reload of the search page will display the expected content. However, with integration tests, we create articles and need them immeditately. This makes tests unreliable.

      We created the test class JournalContentTest.java to show the issue. The test will pass normally when run, but after redeploying journal-article, the test will break with the results show in the ja-test2.txt file attached below:

      com.liferay.journal.example.test.JournalContentTest > test STARTED
      
      com.liferay.journal.example.test.JournalContentTest > test FAILED
          java.lang.ClassCastException: com.liferay.journal.util.impl.JournalContentImpl$JournalContentKey cannot be cast to com.liferay.journal.util.impl.JournalContentImpl$JournalContentKey
              at com.liferay.journal.util.impl.JournalContentImpl$JournalContentArticleKeyIndexEncoder.encode(JournalContentImpl.java:492)
              at com.liferay.portal.kernel.cache.index.PortalCacheIndexer._addIndexedCacheKey(PortalCacheIndexer.java:71)
              at com.liferay.portal.kernel.cache.index.PortalCacheIndexer.access$300(PortalCacheIndexer.java:31)
              at com.liferay.portal.kernel.cache.index.PortalCacheIndexer$IndexerPortalCacheListener.notifyEntryPut(PortalCacheIndexer.java:140)
              at com.liferay.portal.cache.AggregatedPortalCacheListener.notifyEntryPut(AggregatedPortalCacheListener.java:121)
              at com.liferay.portal.cache.ehcache.internal.event.PortalCacheCacheEventListener.notifyElementPut(PortalCacheCacheEventListener.java:142)
              at net.sf.ehcache.event.RegisteredEventListeners.internalNotifyElementPut(RegisteredEventListeners.java:193)
              at net.sf.ehcache.event.RegisteredEventListeners.notifyElementPut(RegisteredEventListeners.java:171)
              at net.sf.ehcache.Cache.notifyPutInternalListeners(Cache.java:1620)
              at net.sf.ehcache.Cache.putInternal(Cache.java:1590)
              at net.sf.ehcache.Cache.put(Cache.java:1515)
              at net.sf.ehcache.Cache.put(Cache.java:1480)
              at com.liferay.portal.cache.ehcache.internal.EhcachePortalCache.doPut(EhcachePortalCache.java:100)
              at com.liferay.portal.cache.BasePortalCache.put(BasePortalCache.java:76)
              at com.liferay.portal.cache.BasePortalCache.put(BasePortalCache.java:59)
              at com.liferay.journal.util.impl.JournalContentImpl.getDisplay(JournalContentImpl.java:248)
              at com.liferay.journal.util.impl.JournalContentImpl.getDisplay(JournalContentImpl.java:319)
              at com.liferay.journal.util.impl.JournalContentImpl.getDisplay(JournalContentImpl.java:305)
              at com.liferay.journal.example.test.JournalContentTest.test(JournalContentTest.java:116)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 [...]
              at java.lang.Thread.run(Thread.java:748)
      
      1 test completed, 1 failed
      There were failing tests. See the report at: file:///home/adam/software/liferay-portal/modules/apps/journal/journal-test/build/reports/tests/testIntegration/index.html
      
      > Task :apps:journal:journal-test:stopTestableTomcat
      
      BUILD SUCCESSFUL in 1m 30s
      124 actionable tasks: 3 executed, 121 up-to-date
      

        Attachments

        1. ja-summary-search1.png
          ja-summary-search1.png
          27 kB
        2. ja-summary-search2.png
          ja-summary-search2.png
          22 kB
        3. ja-test2.txt
          46 kB

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 31 weeks, 2 days ago

                Packages

                Version Package
                7.0.0 DXP FP73
                7.0.10.11 DXP SP11
                7.0.X
                7.1.10 DXP FP7
                7.1.10.2 SP2
                7.1.3 CE GA4
                7.1.X
                Master