0

I'm implementing DD4T Java version2, and trying to use experience manager, Tridion 2013 SP1. But when using session preview, following error occurs.

org.dd4t.core.exceptions.ItemNotFoundException: Unable to find page by url 
'/dd4tj2_cn/en/products-personal/index_e79d3951-0e67-491f-89d3-7584aa333306.html' and publication '64'.
    org.dd4t.providers.impl.BrokerPageProvider.getPageMetaByURL(BrokerPageProvider.java:150)
    org.dd4t.providers.impl.BrokerPageProvider.getPageContentByURL(BrokerPageProvider.java:97)
    org.dd4t.core.factories.impl.PageFactoryImpl.findPageByUrl(PageFactoryImpl.java:136)
    org.dd4t.springmvc.controller.DynamicPageController.handleRequestInternal(DynamicPageController.java:157)
    org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.tridion.preview.web.AbstractContentFilter.doFilter(AbstractContentFilter.java:77)
    com.tridion.preview.web.PageContentFilter.doFilter(PageContentFilter.java:9)
    com.tridion.ambientdata.web.AmbientDataServletFilter.doFilter(AmbientDataServletFilter.java:302)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.dd4t.servlet.filters.ImageFilter.doFilter(ImageFilter.java:217)

It seems that DD4T looks for a page that session preview will create, and there is not such a page in Broker DB. Why DD4T behaves this way? How can I make session preview work?

Regards,

3

This is how XPM works in a non-dd4t environment; it tries to push a file with random filename in the weboot and uses a filter to redirect the user there.

In a dd4t situation, you simply don't use the servlet filter prescribed by XPM. Instead, in your front controller, you check the taf:session:preview:preview_session token in the ambient data store; if that's present then your current request is a preview request. In such a case, you have to make sure that your page lookup is served straight from the Broker and you have to bypass dd4t cache. You can do this in multiple ways depending on the dd4t version you have - either by using a NoCacheAgent in dd4t-1 in a seprate "preview page factory", or by using the preview-aware factory in dd4t-2.

  • Thanks for answer.I'm looking for a class which handles session preview. I tried to call BrokerPageProvider.getPageContentByURL method in dd4t-providers-rs, because it looks handling session preview. But it failed because property of JAXRSClient is null.Would you tell me which class should be used? I'm using DD4T 2. – Hirokazu Shikata Jul 31 '15 at 8:19
  • I had a closer look, and actually the EHCacheProvider from dd4t-2 should check for preview IF you've set the checkPreview property on it in Spring. You should only use the RS project if you run remote providers. – Rogier Oudshoorn Jul 31 '15 at 8:45
  • I deleted Ambient Data Framework filter from web.xml by mistake.After I added it, session preview works. And I have to bypass cache when using cache. – Hirokazu Shikata Jul 31 '15 at 11:52

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.