on 04-28-2017 1:41 PM - last edited on 02-04-2024 5:30 AM by postmig_api_4
Hi,
I am using DataHub 6.2 and using resolve method in target.xml. Resolve method looks like this :resolve('CanonicalAssemblyItemNumberMapObject','SAPORDER_INBOUND_POOL','integrationKey=ZREP')?.tdLineValue.
Resolve method is throwing "MissingReferenceException" when CanonicalItem with Integration key = ZREP is not available. Actually Exception is coming from DataHub OOTB datahub-service-6.2.0.2-RC13 jar. Java class name is DefaultItemResolver.
Please find the attached Exception log.
Thanks in advance
Please follow below steps:
a. Make a sub class of com.hybris.datahub.service.spel.impl.DefaultItemResolver
and override resolve method
@Override
public Object resolve(EvaluationContext ctx, BaseDataItem ctxItem, String type, DataHubPool pool, String... conditions) {
try{
return super.resolve(ctx, ctxItem, type,pool, conditions);
}catch(MissingReferenceException exception){
LOG.warn("Missing reference: "+exception.getMessage());
return null;
}
}
b. Register the resolver in the spring
<alias name="customItemResolver" alias="defaultItemResolver" />
<bean name="customItemResolver" class="<your custom item resolver class>">
<property name="itemService" ref="canonicalItemService" />
<property name="integrationKeyGenerator" ref="integrationKeyGenerator" />
</bean>
c. Now resolve method will return null instead of throwing MissingReferenceException
. Null check can be handled simply by using safe navigation operator ?
in Spring expression (logs shows that you are already using)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
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.