Impex old pk has wrong format on import of custom component to content slot

2.2k Views Asked by At

I am trying to create an impex script in Hybris 6.4 in order to put my custom component into a ContentSlot via the ImpEx Import tool found in the Hybris Administration console. When I run the impex, I get am, old pk has wrong format: 'catalogVersion(CatalogVersion.catalog(Catalog.id[default=apparel-ukContentCatalog])', type code is not an integer.[HY--1] error. I have used the BackOffice application to verify that my custom component is present. What do I need to do to assign my component to the ContentSlot without encountering the old pk has wrong format: 'catalogVersion(CatalogVersion.catalog(Catalog.id[default=apparel-ukContentCatalog])', type code is not an integer.[HY--1] error?

Here is my impex.

<header line is blank>
$contentCatalog=apparel-ukContentCatalog
$catalogVersion=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Online])[default=$contentCatalog:Online]
INSERT_UPDATE ContentSlot;$catalogVersion;uid[unique=true];active;cmsComponents(uid, catalogVersion)
;;SearchResultsGridSlot;true;MyComponent:$catalogVersion

Note that I also tried this variation of the $catalogVersion macro:

$catalogVersion=catalogversion(catalog(id[default=$contentCatalog]),version[default='Online'])[unique=true,default=$contentCatalog:Online]

This is the stack trace for the impex attempt.

ERROR [hybrisHTTP27] (000002C5) [CronJobErrorHandler] line 5 at main script: Exception ocurred, will ignore: de.hybris.platform.impex.jalo.ImpExException: old pk has wrong format: 'catalogVersion(CatalogVersion.catalog(Catalog.id[default=apparel-ukContentCatalog])', type code is not an integer.[HY--1]
de.hybris.platform.impex.jalo.ImpExException: old pk has wrong format: 'catalogVersion(CatalogVersion.catalog(Catalog.id[default=apparel-ukContentCatalog])', type code is not an integer.
    at de.hybris.platform.impex.jalo.imp.DefaultImportProcessor.processInsertUpdateLine(DefaultImportProcessor.java:483) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.DefaultImportProcessor.processItemData_Impl(DefaultImportProcessor.java:259) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.DefaultImportProcessor.processItemData(DefaultImportProcessor.java:158) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.ImpExImportReader.processLine(ImpExImportReader.java:718) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.ImpExImportReader.readLine(ImpExImportReader.java:518) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.Importer.doImport(Importer.java:251) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.Importer.importNextInternal(Importer.java:757) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.Importer.importNext(Importer.java:738) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.cronjob.ImpExImportJob.doImport(ImpExImportJob.java:290) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.cronjob.ImpExImportJob.performJob(ImpExImportJob.java:248) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.cronjob.ImpExImportJob.performCronJob(ImpExImportJob.java:115) [impexserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.execute(Job.java:1390) [processingserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.performImpl(Job.java:814) [processingserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.performImpl(Job.java:732) [processingserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.perform(Job.java:644) [processingserver.jar:?]
    at de.hybris.platform.servicelayer.cronjob.impl.DefaultCronJobService.performCronJob(DefaultCronJobService.java:86) [processingserver.jar:?]
    at de.hybris.platform.servicelayer.impex.impl.DefaultImportService.importData(DefaultImportService.java:437) [impexserver.jar:?]
    at de.hybris.platform.servicelayer.impex.impl.DefaultImportService.importDataUsingStandardImpex(DefaultImportService.java:360) [impexserver.jar:?]
    at de.hybris.platform.servicelayer.impex.impl.DefaultImportService.importData(DefaultImportService.java:104) [impexserver.jar:?]
    at de.hybris.platform.hac.facade.impl.DefaultImpexFacade.importData(DefaultImpexFacade.java:60) [classes/:?]
    at de.hybris.platform.hac.controller.console.ImpexController.handleImpexImportContent(ImpexController.java:189) [classes/:?]

For further investigation, I tried removing the unique attribute from the $catalogVersion macro definition in order to see if any clues could be found, but the error encountered here seems to bolster the necessity of the presence of the unique key attribute on the $catalogVersion macro.

Impex without unique attribute for catalogVersion

<header line is blank>
$contentCatalog=apparel-ukContentCatalog
$catalogVersion=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Online])[default=$contentCatalog:Online]
INSERT_UPDATE ContentSlot;$catalogVersion;uid[unique=true];active;cmsComponents(uid, catalogVersion)
;;SearchResultsGridSlot;true;MyComponent:$catalogVersion

Stack trace for impex without unique attribute

ERROR [hybrisHTTP29] (000002C4) [CronJobErrorHandler] line 5 at main script: Exception ocurred, will ignore: de.hybris.platform.impex.jalo.imp.AmbiguousItemException: More than one item of type ContentSlot found for unique qualifiers {uid2=SearchResultsGridSlot}[HY-0]
de.hybris.platform.impex.jalo.imp.AmbiguousItemException: More than one item of type ContentSlot found for unique qualifiers {uid2=SearchResultsGridSlot}
    at de.hybris.platform.impex.jalo.imp.DefaultExistingItemResolver.resolveByQuery(DefaultExistingItemResolver.java:204) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.DefaultExistingItemResolver.findExisting(DefaultExistingItemResolver.java:133) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.DefaultImportProcessor.processItemData_Impl(DefaultImportProcessor.java:213) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.DefaultImportProcessor.processItemData(DefaultImportProcessor.java:158) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.ImpExImportReader.processLine(ImpExImportReader.java:718) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.imp.ImpExImportReader.readLine(ImpExImportReader.java:518) ~[impexserver.jar:?]
    at de.hybris.platform.impex.jalo.Importer.doImport(Importer.java:251) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.Importer.importNextInternal(Importer.java:757) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.Importer.importNext(Importer.java:738) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.cronjob.ImpExImportJob.doImport(ImpExImportJob.java:290) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.cronjob.ImpExImportJob.performJob(ImpExImportJob.java:248) [impexserver.jar:?]
    at de.hybris.platform.impex.jalo.cronjob.ImpExImportJob.performCronJob(ImpExImportJob.java:115) [impexserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.execute(Job.java:1390) [processingserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.performImpl(Job.java:814) [processingserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.performImpl(Job.java:732) [processingserver.jar:?]
    at de.hybris.platform.cronjob.jalo.Job.perform(Job.java:644) [processingserver.jar:?]
    at de.hybris.platform.servicelayer.cronjob.impl.DefaultCronJobService.performCronJob(DefaultCronJobService.java:86) [processingserver.jar:?]
    at de.hybris.platform.servicelayer.impex.impl.DefaultImportService.importData(DefaultImportService.java:437) [impexserver.jar:?]
    at de.hybris.platform.servicelayer.impex.impl.DefaultImportService.importDataUsingStandardImpex(DefaultImportService.java:360) [impexserver.jar:?]
    at de.hybris.platform.servicelayer.impex.impl.DefaultImportService.importData(DefaultImportService.java:104) [impexserver.jar:?]
    at de.hybris.platform.hac.facade.impl.DefaultImpexFacade.importData(DefaultImpexFacade.java:60) [classes/:?]
    at de.hybris.platform.hac.controller.console.ImpexController.handleImpexImportContent(ImpexController.java:189) [classes/:?]
1

There are 1 best solutions below

10
On

Your catalogverison line different than examples. You try below code.

$contentCatalog=apparel-ukContentCatalog
$catalogVersion=catalogversion(catalog(id[default=$contentCatalog]),version[default=Online])[unique=true,default=$contentCatalog:Online]
INSERT_UPDATE ContentSlot;$catalogVersion;uid[unique=true];active;cmsComponents(uid, $catalogVersion)
;;SearchResultsGridSlot;true;MyComponent

Working impex for this slot in standard system.

$contentCatalog=apparel-ukContentCatalog
$catalogVersion=catalogversion(catalog(id[default=$contentCatalog]),version[default=Online])[unique=true,default=$contentCatalog:Online]
INSERT_UPDATE ContentSlot;$catalogVersion;uid[unique=true];active;cmsComponents(uid, $catalogVersion)
;;SearchResultsGridSlot;true;SearchResultsGrid