meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sap_hybris_commerce:cms_cockpit_wcms:common_reasons_of_synchronisation_failures [2019/12/18 20:18] – external edit 127.0.0.1sap_hybris_commerce:cms_cockpit_wcms:common_reasons_of_synchronisation_failures [2022/10/23 10:02] (current) – [Common reasons of synchronisation failures] Antonio Robirosa
Line 1: Line 1:
 ====== Common reasons of synchronisation failures ===== ====== Common reasons of synchronisation failures =====
  
-A common complain of the users which edit content using the CMS Cockpit is that the synchronisation stops working quite often. During the last two months I solved around thirty seven cases and found sixteen different causes of sync errors((in September 2015)). This is a summary of the categories of errors and tips or measures to prevent them.+A common complain of the users which edit content using the CMS Cockpit is that the synchronisation stops working quite often. During September and October 2015 I solved around 37 cases and found 16 different causes of sync errors. This is a summary of the categories of errors and tips or measures to prevent them
 + 
 +Hybris usually only reports “An exception occurred during synchronization” in the logs, so you have to further analyse that the cause of the failure is.
  
 ===== Procedure to find out why the synchronization isn't working ===== ===== Procedure to find out why the synchronization isn't working =====
Line 34: Line 36:
 ===== Errors Categories ===== ===== Errors Categories =====
  
-^Category^Causes^Countermeasures^Will happen again?^ +^ Category                                                                                                                                                                                            ^ Causes                                                                                                                                                                                                                                                                                                                                            ^ Countermeasures                                                                                                                                                                                                                                                                                                                                                                                                           ^ Will happen again?  ^ 
-^Duplicate CMS((CMS Items are pages, components, content slots for page or for template, content slots, navigation nodes, navigation nodes and links.)) Items (same UID in the a Catalogue Version)| Unknown | - Creation of unique indexes in the tables with CMS items. Please read the detailed explanation below. |No| +^ The CatalogVersionSyncCronJob and CatalogVersionSyncJob don't synchronize any items after the first execution.                                                                                      | Unknown. The cronjob has dump medias after the first successfull execution.                                                                                                                                                                                                                                                                       | - Use each CatalogVersionSyncJob only once. Create them with impex, run them with a groovy script and remove them at the end with impex. You can use the Areco deployment manager for this task \\ - The business and the developers must use SmartEdit or WCMS to sync catalogues. Don't use hmc.                                                                                                                        | No                  | 
-^Mandatory field with a null value or an invalid PK|- Unlink of the CMS Navigation Entries from the navigation nodes \\ - Bugs in the Impex Scripts which lead to null values in the items \\ - Removal of CMS Items, which where changed after the last synchronization, in the WCMS like the removal of a page after working with its content slots. | - To synchronize the catalogue before an user removes a page, a navigation node or another CMS item. This reduces the possibility of a sync error. \\ - Use of removal interceptors to prevent usual cases when it is possible \\ - Impex Scripts: Be more careful when removing CMS Items which may be referenced be another one, for example, content slots are referenced by content slots for pages or for templates |Ja| +^ Duplicate CMS((CMS Items are pages, components, content slots for page or for template, content slots, navigation nodes, navigation nodes and links.)) Items (same UID in the a Catalogue Version)  | Unknown                                                                                                                                                                                                                                                                                                                                           | - Creation of unique indexes in the tables with CMS items. Please read the detailed explanation below.                                                                                                                                                                                                                                                                                                                    | No                  | 
-^Edition mistakes| \\ - Reference to an object which is in a wrong catalogue \\ - Circular References between catalogues| - Limit the access to the catalogues. If the user can't see other catalogues, he can't choose the wrong one \\ - Training of the users to identify this error before calling the developers |Ja| +^ Many ContentSlotsForPage or ContentSlotsForTemplate for the same position, slot and page                                                                                                            | Rename of the content slots for Pages/Templates without removing the old ones                                                                                                                                                                                                                                                                     | - Impex Scripts: Be more careful when renaming content slots and content slots for pages or templates                                                                                                                                                                                                                                                                                                                     | Ja                  
-^Type change of an existent CMS Item| - The same UID points to a CMS components of different types in the source and target catalogues. For example: The carousel components where created and synchronized. Then the same UIDs was used by the new carousels with popularity components. The synchronization will fail because the UID points to components with two different types. | - Remove the components in the target version and synchronize again\\ - Don't reuse the UID. A new component type means new UIDs |Nein|+^ Mandatory field with a null value or an invalid PK                                                                                                                                                  | - Unlink of the CMS Navigation Entries from the navigation nodes \\ - Bugs in the Impex Scripts which lead to null values in the items \\ - Removal of CMS Items, which where changed after the last synchronization, in the WCMS like the removal of a page after working with its content slots.                                                | - To synchronize the catalogue before an user removes a page, a navigation node or another CMS item. This reduces the possibility of a sync error. \\ - Use of removal interceptors to prevent usual cases when it is possible \\ - Impex Scripts: Be more careful when removing CMS Items which may be referenced be another one, for example, content slots are referenced by content slots for pages or for templates  | Ja                  
 +^ Edition mistakes                                                                                                                                                                                    | \\ - Reference to an object which is in a wrong catalogue \\ - Circular References between catalogues                                                                                                                                                                                                                                             | - Limit the access to the catalogues. If the user can't see other catalogues, he can't choose the wrong one \\ - Training of the users to identify this error before calling the developers                                                                                                                                                                                                                               | Ja                  
 +^ Type change of an existent CMS Item                                                                                                                                                                 | - The same UID points to a CMS components of different types in the source and target catalogues. For example: The carousel components where created and synchronized. Then the same UIDs was used by the new carousels with popularity components. The synchronization will fail because the UID points to components with two different types.  | - Remove the components in the target version and synchronize again\\ - Don't reuse the UID. A new component type means new UIDs                                                                                                                                                                                                                                                                                          | Nein                |
  
 ==== Examples of edition mistakes and empty mandatory fields ==== ==== Examples of edition mistakes and empty mandatory fields ====
Line 56: Line 60:
  
 **In every case the item with the error must have been modified after the last synchronization.** If it isn't, the sync process is going to ignore it unless you select "force update" on the synchronisation wizard in hMC. **To teach the WCMS users to synchronize any change before removing a component, page or navigation node and to remove access to other catalogues** reduces the occurrence of the above cases. **In every case the item with the error must have been modified after the last synchronization.** If it isn't, the sync process is going to ignore it unless you select "force update" on the synchronisation wizard in hMC. **To teach the WCMS users to synchronize any change before removing a component, page or navigation node and to remove access to other catalogues** reduces the occurrence of the above cases.
 +
 +==== Useful tips to troubleshoot exceptions during the creation/copy of the target sync-item ====
 +
 +If you get an error similar to:
 +<code>
 +d.h.p.c.j.s.AbstractItemCopyContext : An exception occured during synchronization for item: 8796388590637 of type: Content Slot-Beziehung für eine Seitenvorlage
 +</code>
 +Put a breakpoint inside de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext#copy(de.hybris.platform.catalog.jalo.synchronization.ItemCopyCreator, de.hybris.platform.jalo.Item, de.hybris.platform.jalo.Item, de.hybris.platform.catalog.jalo.ItemSyncTimestamp) to find out what exception was thrown. The sync job don't log the stacktrace of this exception.
 +
 +The cause are usually validate interceptors or after save listeners which prevent creating the target hybris item.
 +
 +==== Userful flexible search queries ====
 +=== Find navigation entries with invalid or missing PKs ===
 +<code>
 +select {c.id} catalog, {cv.version} catalogVersion, {ne.uid} UIDEntry, {ne.pk} pkEntry
 +from {CMSNavigationEntry as ne
 +    JOIN CatalogVersion as cv
 +   ON {cv.pk} = {ne.catalogVersion}
 + JOIN Catalog as c
 +   ON {c.pk} = {cv.catalog}
 +}
 +where {ne.item} is null
 +or NOT EXISTS ({{
 +        SELECT 1
 +        FROM {CMSItem AS i}
 +        WHERE {i:pk} = {ne.item}
 +    }})
 +</code>
 +
  
 ==== Duplicate CMS Items ==== ==== Duplicate CMS Items ====
  
-In one project the synchronisation created duplicate same code or uid— medias, contentslots and navigation nodes. Although the multi-threading in the synchronization was turned off((property catalog.sync.workers)), the system kept generating duplicate medias. The cause of the error is still unknown but **unique indexes for the column catalogVersion and code/uid** on the tables medias, contentslot, cmscomponent, cmsnavigationnode, cmsnavigationentry, slotsfortemplate and slotsforpage solved the issue. After the creation of the index no error message or stack trace is shown in the logs, so further investigation of the issue couldn't be done.+In one project the synchronisation created duplicate **same code or uid** medias, contentslots and navigation nodes. Although the multi-threading in the synchronization was turned off((property catalog.sync.workers)), the system kept generating duplicate medias. The cause of the error is still unknown but **unique indexes for the column catalogVersion and code/uid** on the tables medias, contentslot, cmscomponent, cmsnavigationnode, cmsnavigationentry, slotsfortemplate and slotsforpage solved the issue. After the creation of the index no error message or stack trace is shown in the logs, so further investigation of the issue couldn't be done. 
 + 
 +==== Tips ==== 
 +  * If you a validate interceptor is throwing exceptions during the synchronization, you can turn off its validation by checking if the following attribute is true: 
 +<code> 
 +this.getSessionService().getCurrentSession().getAttribute("catalog.sync.active"); 
 +</code>
  
---Tested on SAP Hybris 5.6+--Tested on SAP Hybris 2005 and 5.6