7

We have a fresh install of DXA 1.7 (Java WebApp) on SDL Web 8.5. We recently enabled the context-expression-module on DXA by enabling the maven profile. The application builds fine and still renders the home page. To push this further we setup Target Groups and set JEXL expressions as outlined in the docs. When I set the Context Expressions using the powershell command I received the following output for both Target Groups:

ExtensionData      : 
ApplicationId      : ce:TargetGroupExtension
Data               : {64, 24, 84, 97...}
ManagedLinks       : 
TypeId             : DataContract:TargetGroupExtensionData, http://wwww.sdltridion.com/ContentManager/Extensions/ContextExpressions/2013, 8.5.0.23314
IsInherited        : 
OwningRepositoryId : 

I used two expressions, one per Target Group: browser.vendor == 'Google' and browser.vendor == 'Mozilla'. I then put two different articles on the home page, one includes the Google target vendor and excludes the Mozilla target vendor. The other article does the opposite. enter image description here

However, when I render the home page I still see both pieces of content rendered for both Chrome and Firefox. I see the following in the DXA WebApp logs:

06:07:52.834 [http-nio-8080-exec-9] TRACE c.s.w.c.i.mapping.SemanticMapperImpl - entity: Article(headline=Welcome Chrome Users, image=null, date=null, description=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut semper ex tortor, a ullamcorper sem venenatis sed. In interdum leo eu orci pharetra luctus. Nulla ut blandit urna, ac maximus mauris., articleBody=[Paragraph(subheading=Chrome Users, content=<p>Chrome Users</p><p>Loremus <span>ipsumis asf;ojsaf;oj;oi dolor sit amet, consectetur adipiscing elit. Ut semper ex tortor, a ullamcorper sem venenatis sed. In interdum leo  mhgvhmvhmghmhgvhgvmhvghnbn   eu orci pharetra luctus. Nulla ut blandit urna, ac maximus mauris. Cras sapien dolor, blandit eu nisi at, pretium facilisis quam. </span></p><p>Donec ipsum ex, pellentesque id diam a, aliquam commodo nibh. Fusce lacinia arcu lorem, volutpat pulvinar quam scelerisque vel. Etiam auctor pulvinar mi, eget pretium odio. Curabitur iaculis nisl augue, fermentum porta arcu condimentum convallis. Ut sit amet nisi a enim blandit accumsan. Integer scelerisque ac nibh a viverra. Ut sed nisi id velit egestas mollis.</p>, media=null, caption=null)])
06:07:52.834 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.834 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.836 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.836 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.836 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.836 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.837 [http-nio-8080-exec-9] TRACE c.s.d.m.c.b.ContextExpressionModelBuilder - Context expression model builder for CP org.dd4t.contentmodel.impl.ComponentPresentationImpl@28710c7e, entity Article(headline=Welcome Chrome Users, image=null, date=null, description=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut semper ex tortor, a ullamcorper sem venenatis sed. In interdum leo eu orci pharetra luctus. Nulla ut blandit urna, ac maximus mauris., articleBody=[Paragraph(subheading=Chrome Users, content=<p>Chrome Users</p><p>Loremus <span>ipsumis asf;ojsaf;oj;oi dolor sit amet, consectetur adipiscing elit. Ut semper ex tortor, a ullamcorper sem venenatis sed. In interdum leo  mhgvhmvhmghmhgvhgvmhvghnbn   eu orci pharetra luctus. Nulla ut blandit urna, ac maximus mauris. Cras sapien dolor, blandit eu nisi at, pretium facilisis quam. </span></p><p>Donec ipsum ex, pellentesque id diam a, aliquam commodo nibh. Fusce lacinia arcu lorem, volutpat pulvinar quam scelerisque vel. Etiam auctor pulvinar mi, eget pretium odio. Curabitur iaculis nisl augue, fermentum porta arcu condimentum convallis. Ut sit amet nisi a enim blandit accumsan. Integer scelerisque ac nibh a viverra. Ut sed nisi id velit egestas mollis.</p>, media=null, caption=null)]) and localization LocalizationImpl(id=10, path=/)
06:07:52.837 [http-nio-8080-exec-9] DEBUG c.s.d.m.c.b.ContextExpressionModelBuilder - Found these context expressions Conditions(includes=[browservendor.google], excludes=[browservendor.mozilla])
06:07:52.837 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.837 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.837 [http-nio-8080-exec-9] TRACE c.s.w.c.util.InitializationUtils - Properties {dxa.tridion.2013.context.repository.load.enabled=true, dxa.web.adf.enabled=true, dxa.web.default.area.name=Core, dxa.tridion.navigation.taxonomy.type.page=Page, dxa.tridion.2013.context.repository.location=../repository, dxa.web.default.action.name=Entity, spring.profiles.active=search.solr, dxa.context.deviceFamilies.file=device-families.xml, dxa.web.views.suffix=.jsp, dxa.web.default.region.name=Main, dxa.modules.cid.className=com.sdl.delivery.image.filter.ContextualImageFilter, dxa.tridion.navigation.taxonomy.marker=[Navigation], dxa.modules.contextexpr.extension_data_map_key=ContextExpressions, dxa.web.views.folder=/META-INF/resources/, dxa.web.default.controller.area.name=Framework, dxa.web.views.override.folder=Override, dxa.context.service.publication.id=true, dxa.web.default.init=true, dxa.json.xpm.aware=true, dxa.modules.cid.mapping=/cid/*, dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode, dxa.tridion.navigation.modelUrl=/navigation.json, dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup, dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed, dxa.web.views.prefix=/WEB-INF/Views/, dxa.web.default.controller.name=Entity} returned
06:07:52.837 [http-nio-8080-exec-9] DEBUG c.s.w.c.impl.DefaultRegionBuilder - Creating region: Main
06:07:52.837 [http-nio-8080-exec-9] DEBUG c.s.w.c.impl.DefaultRegionBuilder - Added new region AbstractViewModel(extensionData=null, htmlClasses=null, xpmMetadata={}, mvcData=MvcDataImpl(controllerAreaName=Framework, controllerName=Region, actionName=Region, areaName=Core, viewName=Main, regionAreaName=null, regionName=null, routeValues={}, metadata={})) to a model set
06:07:53.748 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - Current data context engine impl is class com.sdl.context.odata.client.api.ODataContextEngine
06:07:53.749 [http-nio-8080-exec-9] DEBUG c.s.w.t.c.ContextServiceClaimsProvider - Requested context map for aspect null with evidence [com.sdl.context.api.resolution.ImmutableEvidence@484433899 'map'='{publication-id=[com.sdl.context.api.resolution.ImmutableEvidenceItem@1245381038 'key'='publication-id', 'value'='10', 'origin'='target-group'], user-agent=[com.sdl.context.api.resolution.ImmutableEvidenceItem@1276787773 'key'='user-agent', 'value'='User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 'origin'='http']}'], and got com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12
06:07:53.755 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String null)
06:07:53.755 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String os)
06:07:53.755 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String userRequest)
06:07:53.755 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String ui)
06:07:53.756 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String browser)
06:07:53.756 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String userHttp)
06:07:53.756 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String userServer)
06:07:53.756 [http-nio-8080-exec-9] TRACE c.s.w.t.c.ContextServiceClaimsProvider - #getClaimsMap(ContextMap<? extends Aspect> com.sdl.context.odata.model.adapter.ODataContextMapAdapter@ec34f12, String device)
06:07:53.756 [http-nio-8080-exec-9] DEBUG c.s.d.m.c.c.ContextExpressionEntityEvaluator - Filtered context expressions set is empty, meaning expressions are not in context claims
06:07:53.756 [http-nio-8080-exec-9] DEBUG c.s.d.m.c.c.ContextExpressionEntityEvaluator - Filtered context expressions set is empty, meaning expressions are not in context claims
06:07:53.756 [http-nio-8080-exec-9] DEBUG c.s.d.m.c.c.ContextExpressionEntityEvaluator - All include/exclude context conditions are satisfied, including Entity

Of note here is the fact that the logs contain the following lines:

Found these context expressions Conditions(includes=[browservendor.google], excludes=[browservendor.mozilla]) 
Filtered context expressions set is empty, meaning expressions are not in context claims

Does anyone know why it would be picking up the Target Groups but not be picking up the Context Expressions?

6

Bart, your comment was correct. It seemed that the target groups were published, but the extension dao (<Bundle src="storage_extension_dao_bundle.xml" />) wasn't properly set up, and the deployer_conf.xml also didn't contain the proper pipeline items (so this piece of the documentation wasn't properly installed : https://docs.sdl.com/LiveContent/content/en-US/SDL%20Web-v5/GUID-1E6F175B-85C9-4645-B249-348E5ECF5369),

As a result, the target groups showed as 'published', but they weren't properly stored in the Broker DB ExtensionData table.

Once we added the correct configuration, everything started to work.

  • one additional note : in our client's DXA webapp, the context extensions still weren't working. We found that they had this in their dxa.properties file spring.profiles.active=adf.context.provider. Removing this fixed it for them, since making the adf.context.provider spring profile active would completely disable context services, hence the target group data wouldn't get loaded properly. – Harald Hoffelinck Oct 31 '17 at 9:32

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.