2

On our Web 8.5 instance, the XPM (Experience Manager) session preview doesn't work.

Sympthom is that, after clicking "Update Preview" button, content created on XPM doesn't appear and "The preview for this page is not up to date" message apprears instead. Data is inserted into Session Preview DB successfully.

I installed and configured following modules.

  • Session-enabled Content Service
  • Preview Service
  • Session Web site extension

In the Web site's debug log, following log is output.

2017-08-18 15:41:39,744 DEBUG PageContentFilter - No session has been started!

2017-08-18 15:41:39,744 DEBUG PageContentFilter - No session has been started!

Also I decompiled PageContentFilter.class, and found following code.

PreviewSession session = obtainPreviewSession();
if(session == null)
{
    LOG.debug("No session has been started!");
} else
{

It seems obtainPreviewSession method returning null causes problem.

What cases does obtainPreviewSession method to return null?

My web.xml is following.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
        <display-name>website</display-name>
        <jsp-config>
                <taglib>
                        <taglib-uri>/cd_tags</taglib-uri>
                        <taglib-location>/WEB-INF/tld/content-tags.tld</taglib-location>
                </taglib>
        </jsp-config>
        <servlet-mapping>
                <servlet-name>jsp</servlet-name>
                <url-pattern>*.html</url-pattern>
                <url-pattern>*.jsp</url-pattern>
                <url-pattern>/news_events/*</url-pattern>
                <url-pattern>/api/*</url-pattern>
        </servlet-mapping>

        <filter>
            <filter-name>Ambient Client Filter</filter-name>
            <filter-class>com.sdl.web.ambient.client.AmbientClientFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>Ambient Client Filter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <filter>
            <filter-name>PageContentFilter</filter-name>
            <filter-class>com.sdl.web.preview.client.filter.ClientPageContentFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>PageContentFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <filter>
            <filter-name>BinaryContentFilter</filter-name>
            <filter-class>com.sdl.web.preview.client.filter.ClientBinaryContentFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>BinaryContentFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <filter>
                <filter-name>UrlRewriteFilter</filter-name>
                <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
        </filter>

        <filter-mapping>
                <filter-name>UrlRewriteFilter</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>

        <error-page>
                <error-code>400</error-code>
                <location>/WEB-INF/error/400.html</location>
        </error-page>
</web-app>

Also there is following element in Session Web site extension's cd_client_conf.xml. What value does have to be set in MachineName and FileLocation?

<PreviewService MachineName="MachineName1" FileLocation="C:/temp" DefaultFileSystem="true"/>

PreviewService in cd_client_conf.xml seems to be required. If it's remove, following error occurs.

22-Aug-2017 08:25:56.961 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter PageContentFilter
 java.lang.NullPointerException
        at com.sdl.web.preview.client.session.MachineNameProvider.getMachineName(MachineNameProvider.java:20)
  • 1
    Have you configured ADF in your web.xml? Could you post that configuration? – Raimond Aug 18 '17 at 8:37
  • Yes, I configured ADF in web.xml. I post it. – Hirokazu Shikata Aug 18 '17 at 9:26
  • To find out if Experience Manager is set up properly, run the command java -jar discovery-registration.jar read and verify that PreviewWebServiceCapability and ContentServiceCapability are mentioned in the result. – Velmurugan Aug 19 '17 at 9:47
  • also, ensure that your Preview Service running and port will be accessible on your web app server, enable logback.xml error level to debug to see if you are getting any errors anything in the cd_core.log – Velmurugan Aug 19 '17 at 10:31
  • I confirm that PreviewWebServiceCapability and ContentServiceCapability have registered. I checked configuration, and I noticed there is an element what I cannot understand its value is correct or not. That is "PreviewService" element in Session Web site extension's cd_client_conf.xml. What value is have to be written in this element. I also update my question about that. – Hirokazu Shikata Aug 21 '17 at 10:23
2

To make Session Preview work, enabling following two elements in Session-enabled Content Service's cd_ambient_conf.xml is required. Those are commented out when the service is installed.

<GloballyAcceptedClaims>
    <Claim Uri="taf:session:preview:preview_session"/>
</GloballyAcceptedClaims>

<Cartridge File="cd_webservice_preview_cartridge.xml"/>
  • Can you please mark this as the accepted answer? – Jonathan Williams Jan 8 at 20:48

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.