‎2019 Feb 13 9:47 AM - edited ‎2024 Feb 04 6:06 AM
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,
Request clarification before answering.
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:
The referenced item does not exist in the specified or context pool (see the full signature of the method)
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 .
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.
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
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.