Table of Contents

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 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

Disadvantages of the legacy mode

Errors Categories

Category Causes Countermeasures Will happen again?
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
Duplicate CMS1) 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
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
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

The main causes are mandatory fields with null or invalid PKs values and CMS items using with a wrong catalogue version. These errors may be originated on these 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:

d.h.p.c.j.s.AbstractItemCopyContext : An exception occured during synchronization for item: 8796388590637 of type: Content Slot-Beziehung für eine Seitenvorlage

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 cause are usually validate interceptors or after save listeners which prevent creating the target hybris item.

You can enable logging of stacktraces in the sync jobs by setting synchronization.itemcopycreator.stacktraces to true. You need log level INFO or finer at the Logger de.hybris.platform.catalog.jalo.synchronization.ItemCopyCreator. Please see https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/aa417173fe4a4ba5a473c93eb730a417/1c60bf4de9bf4ada99b587f569bbb9ec.html?locale=en-US

Userful flexible search queries

Find navigation entries with invalid or missing PKs

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}
    }})

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 off2), 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

this.getSessionService().getCurrentSession().getAttribute("catalog.sync.active");

–Tested on SAP Hybris 2005 and 5.6

1)
CMS Items are pages, components, content slots for page or for template, content slots, navigation nodes, navigation nodes and links.
2)
property catalog.sync.workers