cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

MissingReferenceException with custom canonical type

Former Member
0 Kudos
446

Hi experts, I'm facing this issue when defining my custom canonical type in datahub v6.3.

I'm getting MissingReferenceException:

 Caused by: com.hybris.datahub.service.spel.MissingReferenceException: No reference canonical item found with a type: CanonicalCustomField, and conditions: [partyId=0000045733_KNVK, customField=ZPRICECALL]
         at com.hybris.datahub.service.spel.impl.DefaultItemResolver.resolveReference(DefaultItemResolver.java:82) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
         at com.hybris.datahub.service.spel.impl.DefaultItemResolver.resolve(DefaultItemResolver.java:56) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
         at com.hybris.datahub.service.spel.impl.ResolveMethodExecutor.execute(ResolveMethodExecutor.java:48) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
         at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
         at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:85) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
         at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:120) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
         at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:242) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
         at com.hybris.datahub.service.spel.impl.CompilableSpelExpressionProcessor.transform(CompilableSpelExpressionProcessor.java:88) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
         ... 43 common frames omitted

I can't figure out what am I doing wrong. I have defined meta data as the follow.

Raw:

         <item>
         <type>CanonicalCustomField</type>
         <attributes>
             <attribute>
                 <name>partyId</name>
                 <transformations>
                     <transformation>
                         <rawSource>RawDEBMAS</rawSource>
                         <expression>E1KNA1M-KUNNR</expression>
                     </transformation>
                 </transformations>
             </attribute>
             <attribute>
                 <name>customField</name>
                 <transformations>
                     <transformation>
                         <rawSource>RawDEBMAS</rawSource>
                         <expression>E1KNA1M-ZKNA1-ZZFIELD</expression>
                     </transformation>
                 </transformations>
             </attribute>
             <attribute>
                 <name>customValue</name>
                 <transformations>
                     <transformation>
                         <rawSource>RawDEBMAS</rawSource>
                         <expression>E1KNA1M-ZKNA1-ZZVALUE</expression>
                     </transformation>
                 </transformations>
             </attribute>
         </attributes>
     </item>

Canonical:

        <item>
         <type>CanonicalCustomField</type>
         <attributes>
             <attribute>
                 <name>partyId</name>
                 <model>
                     <localizable>false</localizable>
                     <collection>false</collection>
                     <type>String</type>
                     <primaryKey>true</primaryKey>
                 </model>
             </attribute>
             <attribute>
                 <name>customField</name>
                 <model>
                     <localizable>false</localizable>
                     <collection>false</collection>
                     <type>String</type>
                     <primaryKey>true</primaryKey>
                 </model>
             </attribute>
             <attribute>
                 <name>customValue</name>
                 <model>
                     <localizable>false</localizable>
                     <collection>false</collection>
                     <type>String</type>
                     <primaryKey>false</primaryKey>
                 </model>
             </attribute>
         </attributes>
     </item>            

Target:

 <item>
     <type>ContactPerson</type>
     <exportCode>B2BCustomer</exportCode>
     <description>Contact person for the company.</description>
     <updatable>true</updatable>
     <canonicalItemSource>CanonicalPartyRelationship</canonicalItemSource>
     <status>ACTIVE</status>
     <dependencies>
         <dependency>Company</dependency>
         <dependency>CompanyAddress</dependency>
         <dependency>CompanySalesUnit</dependency>
         <dependency>CompanySalesUnitAddress</dependency>
     </dependencies>
     <attributes>
     ...........
     <attribute>
         <name>disableCachePrice</name>
         <localizable>false</localizable>
         <collection>false</collection>
         <transformationExpression>
                 resolve('CanonicalCustomField', 'SAPCUSTOMER_INBOUND_POOL', 'partyId='+#root.relatedPartyId, 'customField=ZPRICECALL')
         </transformationExpression>
         <exportCode>disableCachePrice</exportCode>
     </attribute>
     </attributes>
 </item>


I checked MySql and the new type is not generated on DB. Any help would be really appreciate. Thank you!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Slava, thank you for your answer.

Actually, the item was never composed because Datahub seems to not handle custom types other than the standard ones defined in the party-canonical extension of Hybris. So, I wrote a custom CompositionHandler to load these segments in a standard CanonicalItem.

Slava
Product and Topic Expert
Product and Topic Expert
0 Kudos

There is no difference for DataHub between custom and "standard" item types. They are all custom. The difference is in whether the type is configured for auto-composition or you need to trigger the composition manually in that pool. But you found a solution that's all what matters.

Slava
Product and Topic Expert
Product and Topic Expert
0 Kudos

Simone,

1) DataHub does not generate a table per new type. You can find your types created in RawItemMeta, CanonicalItemMeta and TargetItemMeta tables.

2) The error message is complaining that it's searching for CanonicalCustomField item with attribute values [partyId=0000045733_KNVK, customField=ZPRICECALL] in SAPCUSTOMER_INBOUND_POOL and does not find such item. Most likely such item was never loaded into RawItem; or it was never composed into CanonicalItem; or it exists but not in the SAPCUSOMTER_INBOUND_POOL. Check those conditions.