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)