cancel
Showing results for 
Search instead for 
Did you mean: 

Catalog Synchronization issue due to duplicate media IDs

Former Member
0 Kudos

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
former_member578868
Participant
0 Kudos

Do you have any solution for this? Thanks.

Former Member
0 Kudos

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_member578868
Participant
0 Kudos

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

Former Member
0 Kudos

can you please share cron job

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

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

Answers (3)

Answers (3)

former_member638200
Discoverer
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Sourav,

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

Kindly find the attach screen shot of HMC .

Former Member
0 Kudos

I am getting error when i search for duplicate identifiers through hMC as you have specified above.

Error is: An error occurred during the processing of the search request. Please verify your search conditions and try again.: Missing SELECT clause in '# The query for this view will be generated with the essential data #.

jagbedi
Explorer
0 Kudos

might be a little late now; but you have to select the Catalog Version.

Former Member
0 Kudos