1

I have a dxa field which comes from customMetadataPageModelbuilder code but to get this value i have to publish all the pages i want to handle this error for the pages which aren't republished so if value comes null also from dxa end to my webapp client it doesn't breaks the code so i want to know how i can handle null exceptions at semantic mappings from DXA code. I tried using @Nullable annotation but it didn't work

The code at which error is coming is:

@SemanticProperty("localeFrmPublication") private String localeFrmPublication;

ERROR iS below

at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.buildEntityModel(DefaultModelBuilder.java:115)
at com.sdl.dxa.tridion.mapping.impl.ModelBuilderPipelineImpl.createEntityModel(ModelBuilderPipelineImpl.java:88)
at com.sdl.dxa.tridion.mapping.converter.EntityModelDataConverter.convert(EntityModelDataConverter.java:42)
... 44 common frames omitted
Caused by: com.sdl.webapp.common.exceptions.DxaException: Cannot determine view model type for semantic schema names: '[http://www.sdl.com/web/schemas/core:productSpecificationsEos]'. Please make sure that an entry is registered for this view name in the ViewModelRegistry. Collected exceptions: [com.sdl.webapp.common.exceptions.DxaException: Cannot detect ViewModel for ViewData MvcDataImpl(controllerAreaName=null, controllerName=//www.sdl.com/web/schemas/core, actionName=null, areaName=http, viewName=productSpecificationsEos, regionAreaName=null, regionName=null, routeValues={}, metadata={})]
at com.sdl.webapp.common.impl.model.ViewModelRegistryImpl.getMappedModelTypes(ViewModelRegistryImpl.java:82)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.buildEntityModel(DefaultModelBuilder.java:95)
... 46 common frames omitted
21:09:52.287 [pool-5-thread-3] ERROR c.s.w.c.i.mapping.SemanticMapperImpl - Exception while getting field data for: private com.canon.webapp.cms.dxa.modules.model.OpenTextMediaManagerItem com.canon.webapp.cms.dxa.modules.model.ProductCoreAttributes.productMainImage
com.sdl.webapp.tridion.fields.exceptions.FieldConverterException: Cannot convert a entity model 2029038 to class com.canon.webapp.cms.dxa.modules.model.OpenTextMediaManagerItem for semantic field productMainImage
at com.sdl.dxa.tridion.mapping.converter.EntityModelDataConverter.convert(EntityModelDataConverter.java:48)
at com.sdl.dxa.tridion.mapping.converter.EntityModelDataConverter.convert(EntityModelDataConverter.java:17)
at com.sdl.dxa.tridion.mapping.converter.GenericSemanticModelDataConverter.convert(GenericSemanticModelDataConverter.java:72)
at com.sdl.dxa.tridion.mapping.impl.DefaultSemanticFieldDataProvider.getFieldData(DefaultSemanticFieldDataProvider.java:138)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.lambda$mapSemanticFields$0(SemanticMapperImpl.java:140)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:692)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:672)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.mapSemanticFields(SemanticMapperImpl.java:119)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.createEntity(SemanticMapperImpl.java:105)
at com.sdl.dxa.tridion.mapping.converter.ContentModelDataConverter.convert(ContentModelDataConverter.java:36)
at com.sdl.dxa.tridion.mapping.converter.ContentModelDataConverter.convert(ContentModelDataConverter.java:19)
at com.sdl.dxa.tridion.mapping.converter.GenericSemanticModelDataConverter.convert(GenericSemanticModelDataConverter.java:72)
at com.sdl.dxa.tridion.mapping.impl.DefaultSemanticFieldDataProvider.getFieldData(DefaultSemanticFieldDataProvider.java:138)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.lambda$mapSemanticFields$0(SemanticMapperImpl.java:140)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:692)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:672)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.mapSemanticFields(SemanticMapperImpl.java:119)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.createEntity(SemanticMapperImpl.java:105)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.createViewModel(DefaultModelBuilder.java:151)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.buildEntityModel(DefaultModelBuilder.java:106)
at com.sdl.dxa.tridion.mapping.impl.ModelBuilderPipelineImpl.createEntityModel(ModelBuilderPipelineImpl.java:88)
at com.sdl.dxa.tridion.mapping.converter.EntityModelDataConverter.convert(EntityModelDataConverter.java:42)
at com.sdl.dxa.tridion.mapping.converter.EntityModelDataConverter.convert(EntityModelDataConverter.java:17)
at com.sdl.dxa.tridion.mapping.converter.GenericSemanticModelDataConverter.convert(GenericSemanticModelDataConverter.java:72)
at com.sdl.dxa.tridion.mapping.converter.ListWrapperConverter.convertValue(ListWrapperConverter.java:59)
at com.sdl.dxa.tridion.mapping.converter.ListWrapperConverter.convert(ListWrapperConverter.java:38)
at com.sdl.dxa.tridion.mapping.converter.ListWrapperConverter.convert(ListWrapperConverter.java:19)
at com.sdl.dxa.tridion.mapping.converter.GenericSemanticModelDataConverter.convert(GenericSemanticModelDataConverter.java:72)
at com.sdl.dxa.tridion.mapping.impl.DefaultSemanticFieldDataProvider.getFieldData(DefaultSemanticFieldDataProvider.java:138)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.lambda$mapSemanticFields$0(SemanticMapperImpl.java:140)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:692)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:672)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.mapSemanticFields(SemanticMapperImpl.java:119)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.createEntity(SemanticMapperImpl.java:105)
at com.sdl.dxa.tridion.mapping.converter.ContentModelDataConverter.convert(ContentModelDataConverter.java:36)
at com.sdl.dxa.tridion.mapping.converter.ContentModelDataConverter.convert(ContentModelDataConverter.java:19)
at com.sdl.dxa.tridion.mapping.converter.GenericSemanticModelDataConverter.convert(GenericSemanticModelDataConverter.java:72)
at com.sdl.dxa.tridion.mapping.impl.DefaultSemanticFieldDataProvider.getFieldData(DefaultSemanticFieldDataProvider.java:138)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.lambda$mapSemanticFields$0(SemanticMapperImpl.java:140)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:692)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:672)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.mapSemanticFields(SemanticMapperImpl.java:119)
at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.createEntity(SemanticMapperImpl.java:105)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.createViewModel(DefaultModelBuilder.java:151)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.buildEntityModel(DefaultModelBuilder.java:106)
at com.sdl.dxa.tridion.mapping.impl.ModelBuilderPipelineImpl.createEntityModel(ModelBuilderPipelineImpl.java:88)
at com.sdl.dxa.tridion.mapping.impl.ModelBuilderPipelineImpl.createEntityModel(ModelBuilderPipelineImpl.java:76)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.createEntityModel(DefaultModelBuilder.java:394)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.lambda$addEntitiesToRegionModels$3(DefaultModelBuilder.java:355)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.addEntitiesToRegionModels(DefaultModelBuilder.java:359)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.createRegionModel(DefaultModelBuilder.java:341)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.processRegions(DefaultModelBuilder.java:274)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.buildPageModel(DefaultModelBuilder.java:264)
at com.sdl.dxa.tridion.mapping.impl.ModelBuilderPipelineImpl.createPageModel(ModelBuilderPipelineImpl.java:60)
at com.sdl.dxa.tridion.mapping.impl.GraphQLContentProvider.loadPage(GraphQLContentProvider.java:181)
at com.sdl.dxa.tridion.mapping.impl.AbstractContentProvider.getPageModel(AbstractContentProvider.java:70)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy158.getPageModel(Unknown Source)
at com.sdl.webapp.common.controller.PageController.getPageModel(PageController.java:305)
at com.sdl.webapp.common.controller.PageController.handleGetPage(PageController.java:123)
at com.canon.webapp.core.thymeleaf.controller.BaseThymeleafController.lambda$0(BaseThymeleafController.java:297)
at com.canon.webapp.core.thymeleaf.config.ContextAwareCallable.call(ContextAwareCallable.java:27)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.sdl.webapp.common.exceptions.DxaException: Exception happened while creating a entity model from: EntityModelData(super=ViewModelData(schemaId=1828646, htmlClasses=null, xpmMetadata=null, metadata=null, extensionData=null, mvcData=null), id=2029038, contextId=0, namespace=tcm, componentTemplate=null, linkUrl=, content=null, binaryContent=null, externalContent=null)
at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.buildEntityModel(DefaultModelBuilder.java:115)
at com.sdl.dxa.tridion.mapping.impl.ModelBuilderPipelineImpl.createEntityModel(ModelBuilderPipelineImpl.java:88)
at com.sdl.dxa.tridion.mapping.converter.EntityModelDataConverter.convert(EntityModelDataConverter.java:42)
... 78 common frames omitted
1
  • Can you please ensure the entire Stack Trace is formatted as a code block? Currently only the first part is, making the Question extremely long and hard to read. Apr 11 at 10:22

1 Answer 1

1

In general, if a View Model property does not have an associated value in the CM data, the Semantic mapping will just leave the property null rather than throw an exception.

However, in your case, there is a specific problem which does make the Semantic mapping throw an exception:

Cannot determine view model type for semantic schema names: '[http://www.sdl.com/web/schemas/core:productSpecificationsEos]'. Please make sure that an entry is registered for this view name in the ViewModelRegistry. 

So, apparently you don't have a View Model type registered at all for Semantic Entity "productSpecificationsEos". If you do register a View Model type, this exception should disappear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.