2

I am getting Claimstore as Null in java. My claim store is null from the below code.:

 @SneakyThrows(ParseException.class)
    private ResultSet executeSmartTargetQuery(AbstractSmartTargetPageModel stPageModel, final TcmUri pageUri) throws SmartTargetException {
        TcmUri publicationUri = new TcmUri(TcmUtils.buildPublicationTcmUri(pageUri.getPublicationId()));

        ClaimStore claimStore = AmbientDataContext.getCurrentClaimStore();
        System.out.println("Claim Store "+ claimStore);
        String triggers = AmbientDataHelper.getTriggers(claimStore);

I got to know the filter mapping to be add, ADF ClaimStore not available (null) in Java Application After that I added the filter in below code, I am getting 404 Error:

public class WebAppConfiguration implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        AnnotationConfigWebApplicationContext servletAppContext = new AnnotationConfigWebApplicationContext();
        servletAppContext.register(DxaSpringInitialization.class);
        servletAppContext.register(CeairModuleInitializer.class);

        servletContext.addListener(new ContextLoaderListener(servletAppContext));

        ServletRegistration.Dynamic registration = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(servletAppContext));
        registration.setLoadOnStartup(1);
        registration.addMapping("/");

        registerFilter(servletContext, AmbientClientFilter.class, "/*");
    }

MY dxa.property file is as follows :

#EHCache configuration
#cache expired elements for amount of seconds
cache.expired.ttl=120
cache.dependency.ttl=120
cache.ttl=1800

## DXA

# Web Properties
#dxa.web.views.prefix=/WEB-INF/Views/
#dxa.web.views.suffix=.jsp

# Possible profiles:
# search.aws - Activates AWS in Search, Not compatible with search.solr
# search.solr - Activates SOLR in Search, Not compatible with search.aws
# dxa.no-cache - Makes DXA use NoCacheProvider in Tridion
# test Activates - Testing context, Only affects unit testing. Activated in Tests by default. Doesnt affect application.
spring.profiles.active=search.solr,adf.context.provider 

# Multiple-line configuration is possible
#spring.profiles.active=search.solr, \
#  dxa.no-cache

#spring.profiles.include=

## Modules
# - All commented are optional

# Mapping for CID resolver (Filter or Servlet)
#dxa.modules.cid.mapping=/cid/*

# Class to use as a resolver for CID images
dxa.modules.cid.className=com.sdl.context.image.servlet.ImageTransformerServlet

# External path to the server which runs DXA for back-mapping for CID Service
#dxa.modules.cid.appHostMapping=localhost:8088

# Redirect link for XO GA client
#dxa.modules.xo.fallbackRedirectUrl=/redirect/

Do someone have any idea, how to solve it.

2

The problem is likely that the AmbientClientFilter is not enabled.

It should not be needed to do that in code like you tried; it should be done through DXA properties configuration. This config has changed quite a bit in earlier DXA versions (IIRC, for some versions you still needed a web.xml).

I would recommend to try with a newer DXA version. Preferably the latest (DXA 1.6 since you're on 2013 SP1), but if you try DXA 1.5, you can get away without changing the CM-side.

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.