8

Good Morning!

This is my scenario :

I created a cartridge and I successfully added the new claims to the ClaimStore. I am sure about it because i am using the ClaimPageAspx.aspx page to list all the claims that i have, so i can see the new claims.

The problem is that when I try to access to the ClaimStore from a Java Application, I am getting a null value for the ClaimStore, the following are some details about my environment :

  • I have a totally operating application using the ClaimStore in .Net in the same environment (same computer).
  • I copied the entire bin/lib and bin/config from my .net app to my WEB-INF/lib and WEB-INF/classes respectively.
  • I followed the configuration from the documentation (login required).

Java Code

    ClaimStore claims = AmbientDataContext.getCurrentClaimStore();
    //claims is always null!!!
    if(claims != null)
    {
        Map<URI, Object> x = claims.getAll();
        for (Map.Entry<URI, Object> entry : x.entrySet())
        {
            //print the claims
        }
    }

cd_ambient_config.xml

<Cartridges>       
    <Cartridge File="cd_webservice_preview_cartridge.xml"/>
    <Cartridge File="footprint_cartridge_conf.xml"/>

    <Cartridge File="smarttarget_cartridge_conf.xml"/>
    <Cartridge File="/client_cookie_cartridge.xml" />
    <Cartridge File="/session_cartridge_conf.xml"/>
</Cartridges>
<!--<ClaimStoreProvider>com.tridion.siteedit.preview.PreviewClaimStoreProvider</ClaimStoreProvider>-->

web.xml (java application)

    <filter>
        <filter-name>Ambient Data Framework</filter-name>
        <filter-class>com.tridion.ambientdata.web.AmbientDataServletFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>Ambient Data Framework</filter-name>
        <servlet-name>Content Delivery Web service</servlet-name>
    </filter-mapping>

Logback Configuration

    <appender name="rollingSmartTargetLog2" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.folder}/smarttarget.others.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>${log.history}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <prudent>true</prudent>
    </appender> 

    <logger name="com.tridion.ambientdata" level="${log.level}">
        <appender-ref ref="rollingSmartTargetLog2"/>
    </logger>

Log Results Java App (failing)

    2014-01-15 08:18:02,063 DEBUG AmbientDataServletFilter - init
    2014-01-15 08:18:02,069 DEBUG AmbientDataContext - Setting current ambient data context: com.tridion.ambientdata.web.WebContext

Log Results from .Net App (working!)

    2014-01-15 08:22:36,598 WARN  AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
    2014-01-15 08:22:36,615 DEBUG AmbientDataContext - Setting current ambient data context: com.tridion.ambientdata.web.WebContext
    2014-01-15 08:22:37,120 DEBUG ClaimStore - put: uri=taf:response:cookie:generation, value=true
    2014-01-15 08:22:37,124 DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@326b9c84, thread: Thread-1
    2014-01-15 08:22:37,139 DEBUG ClaimStore - put: uri=taf:request:uri, value=/ClaimPageAspx.aspx
    2014-01-15 08:22:37,140 DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://localhost:49/ClaimPageAspx.aspx
    2014-01-15 08:22:37,151 DEBUG ClaimStore - put: uri=taf:request:headers, value={cookie=[Ljava.lang.String;@36f0b7f8, cache-control=[Ljava.lang.String;@75be16f5, connection=[Ljava.lang.String;@12d56b37, host=[Ljava.lang.String;@7971f189, accept-language=[Ljava.lang.String;@27a897a9, accept=[Ljava.lang.String;@2d7cec96, user-agent=[Ljava.lang.String;@6490832e, accept-encoding=[Ljava.lang.String;@4b947496, pragma=[Ljava.lang.String;@7f724a9d}
    2014-01-15 08:22:37,151 DEBUG ClaimStore - put: uri=taf:request:cookies, value={TAFSessionId=tridion_d07e08e0-fabc-48c9-956e-28ffb2faeb69, ASP.NET_SessionId=ukccfpqsmpwypm2c33w4ouix, TAFTrackingId=tridion_97548887-5f98-429b-9761-fdab7e7d1aac}
    2014-01-15 08:22:37,152 DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@2880cac9, QUERY_STRING=[Ljava.lang.String;@1f8166e5}
    2014-01-15 08:22:37,153 DEBUG ClaimStore - put: uri=taf:server:variables, value={REMOTE_USER=, PATH_TRANSLATED=C:\inetpub\wwwroot\Claims\ClaimPageAspx.aspx, SERVER_PORT=49, SCRIPT_NAME=/ClaimPageAspx.aspx, REMOTE_ADDR=::1, AUTH_TYPE=, SERVER_PROTOCOL=HTTP/1.1, REQUEST_METHOD=GET, DOCUMENT_ROOT=null, REMOTE_HOST=::1, SERVER_NAME=localhost, SECURE=false}
    2014-01-15 08:22:37,157 DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_d07e08e0-fabc-48c9-956e-28ffb2faeb69
    2014-01-15 08:22:37,157 DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_97548887-5f98-429b-9761-fdab7e7d1aac
    2014-01-15 08:22:37,164 DEBUG ClaimStore - put: uri=taf:session:attributes, value={Tridion.ContentDelivery.AmbientData.ClaimStore=Tridion.ContentDelivery.AmbientData.ClaimStore}
    2014-01-15 08:22:37,168 DEBUG ClaimStore - put: uri=taf:claim:client:concerned_mom, value=0
    2014-01-15 08:22:37,169 DEBUG ClaimStore - put: uri=taf:claim:client:finacially_constrained, value=0
    2014-01-15 08:22:37,170 DEBUG ClaimStore - put: uri=taf:claim:client:lead_form_submited, value=0
    2014-01-15 08:22:37,171 DEBUG ClaimStore - put: uri=taf:claim:client:young_achiever, value=0
    2014-01-15 08:22:37,256 DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@326b9c84, thread: Thread-1
    2014-01-15 08:22:37,257 DEBUG WebContext - setCurrentClaimStore: null, thread: Thread-1

Sorry about the long of this question, but i did not want to leave any detail.

Thank in advance.

Have a good day!

Regards yeremy

1 Answer 1

7

I think the servlet-name in your filter mapping might be the problem here:

<filter-mapping>
    <filter-name>Ambient Data Framework</filter-name>
    <servlet-name>Content Delivery Web service</servlet-name>
</filter-mapping>

So your ADF Filter doesn't come into play for your Java app, since it seems to be mapped to the odata servlet instead.

Try removing the servlet-name and making the ADF filter act for all urls like this:

<filter-mapping>
  <filter-name>Ambient Data Framework</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>
3
  • @Nickoli, I am having the same issue. But I dont have the web.xml. Do you know where we can configure the same servlet? Commented Feb 2, 2017 at 10:12
  • What app server are you on? Web.xml is pretty standard to java web apps. Commented Feb 2, 2017 at 12:58
  • @NickoliRoussakov : Can you please look over tridion.stackexchange.com/questions/16510/… Commented Feb 14, 2017 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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