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