title: UI Layout Initialization Error PrimeFaces 6.2
body: <p>The following code works fine with <strong>PrimeFaces 6.0</strong> and <strong>6.1</strong>, but with <strong>6.2</strong> when I click on button <em>Validate</em> I see the dialog with the message:</p>
  
  <pre><code>/ UI Layout Initialization Error  
  The center-pane element does not exist.  
  The center-pane is a required element.
  </code></pre>
  
  <p>I Use: <code>JSF 2.2</code>, <code>PrimeFaces 6.2</code>, <code>Tomcat 8.5.23</code></p>
  
  <p>Is there something wrong with the code or the problem is in <code>PrimeFaces 6.2</code> ?</p>
  
  <p><a href="https://i.stack.imgur.com/c52PA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c52PA.png" alt="enter image description here"></a></p>
  
  <p><em>Company.java</em></p>
  
  <pre><code>import java.io.Serializable;
  
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.ViewScoped;
  
  import com.company.helper.MessagesHelper;
  
  @ManagedBean(name = "company")
  @ViewScoped
  public class Company implements Serializable {
  
      private static final long serialVersionUID = -8386148997526982963L;
  
      private String regNumber;
  
      public void validateRegNumber() {
          if(regNumber == null || regNumber.equals("")) {
              MessagesHelper.addMessageError("Invalid Registration Number!");
          } else {
              MessagesHelper.addMessage("Registration Number is Valid!");
          }
      }
  
      public String getRegNumber() {
          return regNumber;
      }
  
      public void setRegNumber(String regNumber) {
          this.regNumber = regNumber;
      }
  }
  </code></pre>
  
  <p><em>MessagesHelper.java</em></p>
  
  <pre><code>import javax.faces.application.FacesMessage;
  import javax.faces.context.FacesContext;
  
  public class MessagesHelper {
      public static void addMessage(String summary) {
          addMessage(summary, null);
      }
  
      public static void addMessageError(String summary) {
          addMessageError(summary, null);
      }
  
      public static void addMessage(String summary, String detail) {
          FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, detail);
          FacesContext.getCurrentInstance().addMessage(null, message);
      }
  
      public static void addMessageError(String summary, String detail) {
          FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, summary, detail);
          FacesContext.getCurrentInstance().addMessage(null, message);
      }
  }
  </code></pre>
  
  <p><em>validation.xhtml</em></p>
  
  <pre><code>&lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui" 
      template="../templates/template.xhtml"&gt;    
      &lt;ui:define name="content"&gt;
          &lt;h:form id="frmValidate"&gt;
              &lt;p:growl id="msgs" showDetail="true" /&gt; 
              &lt;div class="ui-fluid"&gt;  
                  &lt;div class="ui-grid ui-grid-responsive"&gt;
                      &lt;div class="ui-grid-row"&gt;
                          &lt;p:outputLabel for="regNumber" value="Registration Number: "&gt;&lt;/p:outputLabel&gt;                               
                          &lt;p:inputText id="regNumber" styleClass="inputClass" value="#{company.regNumber}" /&gt;
                          &lt;p:commandButton value="Validate" id="btnValidate" ajax="false" action="#{company.validateRegNumber()}" /&gt;  
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/h:form&gt;
      &lt;/ui:define&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p><em>footer.xhtml</em></p>
  
  <pre><code>&lt;!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"&gt;
      &lt;center&gt;
          &lt;h:outputText style="font-size:13" value="Company Name 2018" /&gt;
      &lt;/center&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p><em>header.xhtml</em></p>
  
  <pre><code>&lt;!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"&gt;
      &lt;center&gt;
          &lt;h:form id="formWelcome"&gt;
              &lt;p:toolbar id="toolbarWelcome"&gt;
                  &lt;p:toolbarGroup align="left" styleClass="my-toolbar-group-left"&gt;
                      &lt;h:outputText value="Project Name" /&gt;
                  &lt;/p:toolbarGroup&gt;
                  &lt;p:toolbarGroup align="right"&gt;
                      &lt;p:outputLabel for="uname" value="Username:" /&gt;
                      &lt;p:outputLabel id="uname" value=" myUserName" /&gt;
                  &lt;/p:toolbarGroup&gt;
              &lt;/p:toolbar&gt;
          &lt;/h:form&gt;
      &lt;/center&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p><em>menu.xhtml</em></p>
  
  <pre><code>&lt;!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"&gt;
      &lt;h:form&gt;
          &lt;p:panelMenu style="width:212px"&gt;
              &lt;p:submenu label="Main Menu"&gt;
                  &lt;p:menuitem value="Submenu 1"/&gt;
                  &lt;p:menuitem value="Submenu 2"/&gt;
              &lt;/p:submenu&gt;
          &lt;/p:panelMenu&gt;
      &lt;/h:form&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p><em>template.xhtml</em></p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core" &gt;
  
  &lt;f:view contentType="text/html" encoding="UTF-8"&gt;
    &lt;h:head&gt;
     &lt;f:facet name="first"&gt;
         &lt;link rel="shortcut icon" type="image/x-icon" href="#{resource['images/favicon.ico']}" /&gt;  
         &lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt;
         &lt;meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /&gt;
         &lt;title&gt;Project Name&lt;/title&gt;
     &lt;/f:facet&gt; 
  
      &lt;f:facet name="middle"&gt;
          &lt;h:outputStylesheet name="css/style.css" /&gt;
     &lt;/f:facet&gt;
   &lt;/h:head&gt;
     &lt;h:body&gt;
      &lt;p:layout fullPage="true" resizeTitle="resize"&gt;
          &lt;p:layoutUnit  position="north"  id="north" size="60" resizable="false"&gt;
              &lt;ui:include src="header.xhtml" /&gt;
          &lt;/p:layoutUnit&gt;
  
          &lt;p:layoutUnit id="west" position="west" size="220" resizable="false" gutter="2" header="Actions" effect="slide" collapsible="true" &gt;
              &lt;ui:include src="menu.xhtml" /&gt;
          &lt;/p:layoutUnit&gt;
  
           &lt;p:layoutUnit id="center" styleClass="layoutUnitCenter" position="center" resizable="false"&gt;               
                  &lt;!-- For PrimeFaces &lt;= 6.1 --&gt;
                  &lt;!-- 
                      &lt;p:messages id="msgs" showSummary="true" autoUpdate="true" /&gt;
                      &lt;ui:insert name="content" /&gt;
                   --&gt;
  
                  &lt;!-- For PrimeFaces == 6.2 --&gt;
                  &lt;p:fragment&gt;
                      &lt;p:messages id="msgs" showSummary="true"&gt;
                          &lt;p:autoUpdate /&gt;
                      &lt;/p:messages&gt;
                  &lt;/p:fragment&gt;
                  &lt;ui:insert name="content" /&gt;
          &lt;/p:layoutUnit&gt;
  
          &lt;p:layoutUnit position="south" resizable="false" id="south" closable="false" collapsible="false"&gt;
              &lt;ui:include src="footer.xhtml" /&gt;
          &lt;/p:layoutUnit&gt;
      &lt;/p:layout&gt;
      &lt;/h:body&gt;
  &lt;/f:view&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><em>web.xml</em></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://xmlns.jcp.org/xml/ns/javaee"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                          http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
      id="WebApp_ID" version="3.1"&gt;
  
      &lt;display-name&gt;Project&lt;/display-name&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
          &lt;param-value&gt;server&lt;/param-value&gt;
      &lt;/context-param&gt;    
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
          &lt;param-value&gt;Development&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
          &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;async-supported&gt;false&lt;/async-supported&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>