Skip to Content
author's profile photo Former Member
Former Member

Catalog Synchronization issue due to duplicate media IDs

Unable to synchronize the catalog from staged to online.

Please let me know, how to resolve this issue.

Error is:

            ERROR [000015O2::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000015O2) [CatalogVersionSyncJob] Cannot use source catalog version hybrisContentCatalog/Staged(8796125889113) for synchronization since it owns 1 duplicate Media IDs
              ERROR [000015O2::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000015O2) [CatalogVersionSyncJob] Aborted due to version validation error
Add comment
10|10000 characters needed characters exceeded

  • Former Member Former Member

    Hi Vinil,

    I followed Eduard's answer and resolved.

    To delete the duplicate media ids, execute the following flexible search query provided in his answer to get the list of duplicate items. Then, after getting the duplicate items list, delete these through hMC-> Multimedia -> Media

  • Former Member Former Member

    I wrote a cronjob to delete all the duplicate medias using Edurad's solution. It is working better for me now.

  • Former Member

    can you please share cron job

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2015 at 10:04 AM

    Hi Sourav,

    The issue is self-explanatory: you have 2 media items with the same ID (usually you end up with more such pairs).

    One way of getting rid of them is to initialize the platform.

    The other would be to "hunt" the duplicate medias and delete one of each pair (if not both, since these are usually media dump files, not images). You can retrieve them using an SQL query like this:

     select {m:code} from {Media as m} where {m:catalogVersion} = '8796093088345' group by {m:code} having count(*) > 1
    
    

    Regards, Eduard

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2015 at 02:28 PM

    Hi Sourav,

    You can also find duplicate identifiers from HMC using the catalog version.

    Kindly find the attach screen shot of HMC .alt text


    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2017 at 12:24 PM

    Hi Vinit,

    Can you please share the cron job code as i am running the below groovy script in cron job . This is deleting duplicate items but after sync somponents are not getting attached to the right media.It's really urgent please suggest :

    import de.hybris.platform.servicelayer.search.FlexibleSearchQuery; import de.hybris.platform.servicelayer.search.SearchResult; import java.util.List; import de.hybris.platform.core.model.media.MediaModel; import org.apache.log4j.Logger; import com.loblaw.egrocery.highjump.jobs.HighJumpProductExportJob;

    FlexibleSearchQuery query = new FlexibleSearchQuery("Select {pk} from {Media!} where rowId NOT IN ({{SELECT MIN(rowid) FROM {Media!} GROUP BY {code}, {catalogversion} }}) AND {s3imagename} IS NOT NULL"); SearchResult result = flexibleSearchService.search(query); List list = result.getResult(); Logger LOG = Logger.getLogger("Groovy Script");

    if(list!=null && !list.isEmpty()){ LOG.error("Removing "+ list.size()+ " duplicate media instances... "+ list); modelService. removeAll(list); } else { LOG.error("No duplicate media found..."); }

    It will be helpful

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 05, 2018 at 01:13 PM

    I Should say thanks for the above solution. I had really bad scenario and this given me quick solution through HMC duplicate ItemTypes with the below error: It is resolved now. Cannot use source catalog version ContentCatalog/Staged(***) for synchronization since it owns 6 duplicate CMSItem IDs

    Add comment
    10|10000 characters needed characters exceeded