将自定义组件导入内容槽时,Impex旧pk的格式错误

时间:2018-10-01 17:57:45

标签: hybris impex

我正在尝试在Hybris 6.4中创建impex脚本,以便通过Hybris管理控制台中的ImpEx导入工具将自定义组件放入ContentSlot。运行impex时,出现old pk has wrong format: 'catalogVersion(CatalogVersion.catalog(Catalog.id[default=apparel-ukContentCatalog])', type code is not an integer.[HY--1]错误。我已经使用BackOffice应用程序来验证是否存在我的自定义组件。我该怎么做才能将组件分配给ContentSlot而不遇到old pk has wrong format: 'catalogVersion(CatalogVersion.catalog(Catalog.id[default=apparel-ukContentCatalog])', type code is not an integer.[HY--1]错误?

这是我的提示。

<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

请注意,我还尝试了$ catalogVersion宏的以下变体:

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

这是用于impex尝试的堆栈跟踪。

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/:?]

为了进行进一步的研究,我尝试从$ catalogVersion宏定义中删除唯一属性,以查看是否可以找到任何线索,但是此处遇到的错误似乎支持必须在唯一属性上存在唯一键属性。 $ catalogVersion宏。

Impex没有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

没有唯一属性的impex的堆栈跟踪

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 个答案:

答案 0 :(得分:2)

您的商品目录行不同于示例。您尝试下面的代码。

$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

该插槽在标准系统中的正常工作状态。

$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