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

com.hybris.datahub.service.spel.MissingReferenceException

Former Member
0 Likes
963

Hi Experts ,

We have getting below issues in production environment as below :

com.hybris.datahub.service.spel.MissingReferenceException : No reference canonical item found with a type: CanonicalProductUnit, and conditions: []

Can anyone please provide the details what could be the root cause and why it's happening.

Thanks in advance .

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Slava
Product and Topic Expert
Product and Topic Expert
0 Likes

References are resolved by using resolve('<Type>') expressions in the data model. In your specific case there is an attribute that contains resolve('CanonicalProductUnit') - probably it's CanonicalProduct.unit. There are two reasons why a resolve() call would fail:

  1. The referenced item does not exist in the specified or context pool (see the full signature of the method)

  2. The resolve expression is not valid.

Considering that the error message lists empty conditions I suspect it's the latter case. Resolve works by finding an item of the specified type, i.e. CanonicalProductUnit, with its integrationKey equal to the value of the referencing attribute, ie. CanonicalProduct.unit. That means if the context item has attribute unit with value 'pieces' the resolve function tries to find a CanonicalProductUnit item which has value of its integrationKey equal to 'pieces'. Since the integerationKey value is generated from the item key attributes, it's important to correctly define key attributes in the referenced item. If I'm not mistaken, the key attribute of Unit is code. If the value to lookup is constant, i.e. it's always 'pieces', then the condition can be added explicitly: resolve('CanonicalProductUnit', 'integrationKey=pieces')

See details here: https://help.hybris.com/1811/hcd/ea393309fe6f40eebcec24ec79950f73.html

The bottom line it's very likely you have to adjust the referencing attribute model or the key attribute(s) in the referenced item, because it's either refers invalid type or does not provide correct key matching the value of the referencing attribute. Otherwise, the referenced item does not exist in DataHub.

Former Member
0 Likes

Hi Slava,link text

Thanks for your valuable input on this .

But i have more concern on this and sharing with you here .

i have analysed this issues again and found that :

Actually we are getting ,

TransformationExpressionException: Could not transform by expression GTIN?:resolve('CanonicalProductUnit').EAN?:''

Caused by: com.hybris.datahub.service.spel.MissingReferenceException: No reference canonical item found with a type: CanonicalProductUnit, and conditions: []

and because of that getting error as : "Failed to create a target item from CanonicalItem"

Apart from this , i have also noticed that , getting some value null like GTIN=Null etc . not sure this value is also considerable for this type of error as above.

Could you please check one more time and let me know what will be exact root cause of this issues and why it's happen .

Please find attacehd logs for details .

Thanks in advance again .

Slava
Product and Topic Expert
Product and Topic Expert
0 Likes

Satish,

GTIN?:resolve('CanonicalProductUnit').EAN?:'' means take value of the GTIN attribute from the canonical item and use it, if it's not null. If it's null, then lookup value of the EAN attribute in the referenced CanonicalProductUnit item and use it, if it's not null, or otherwise use '' value.

In your case apparently GTIN attribute is null, so we perform lookup of the CanonicalProductUnit as I described in my answer, but we can't find that item. Hence the error.

Former Member
0 Likes

Hi ,

I agreed with your explanation .But still i have one more confusion whenever i seeing Idocs which one used before throwing this exception .

I'm able to see "EAN" attribute with value in IDocs as "EAN11": "00944285005".

If we are getting this value in DeliveryIdocs then why we are getting null for "EAN".

Please find attached delivery IDocs .

Regards, link text

Slava
Product and Topic Expert
Product and Topic Expert
0 Likes

Null is coming from GTIN attribute, not EAN. Because GTIN is null, we try to resolve the CanonicalProductUnit and then take EAN attribute of the resolved CanonicalProductUnit. That resolve fails anyway, so the value of EAN is never read

Answers (0)

Ask a Question