title: Suddenly stopped working. .xhtml Not Found in ExternalContext as a Resource
body: <p>While developing my webapp everything was working fine until when after creating new .xhtml page something went wrong. New page did not render tag`s. Now after trying a restart when I try to deploy my webapp I get the fallowing error "/odczytyEE2.xhtml Not Found in ExternalContext as a Resource".</p>
  
  <p>my login.xhtml</p>
  
  <pre><code>&lt;h:body&gt;        
      &lt;h:form id="loginForm"&gt;          
          &lt;p:growl id="msg" showDetail="true" life="3000" /&gt;
          &lt;p:panel header="Login" style="width: 360px; margin-left:35%; margin-right:45%; margin-top:15%"&gt;
  
              &lt;h:panelGrid id="loginPanel" columns="2"&gt;
  
                  &lt;h:outputText value="Username" /&gt;
  
                  &lt;p:inputText id="username" value="#{login.login}" &gt;&lt;/p:inputText&gt;
  
                  &lt;p:spacer&gt;&lt;/p:spacer&gt;
  
                  &lt;p:message for="username" &gt;&lt;/p:message&gt;
  
                  &lt;h:outputText value="Password" /&gt;
  
                  &lt;p:password id="password" value="#{login.password}"  feedback="false"&gt;&lt;/p:password&gt;
  
                  &lt;p:spacer&gt;&lt;/p:spacer&gt;
  
                  &lt;p:message for="password"&gt;&lt;/p:message&gt;
  
                  &lt;p:spacer&gt;&lt;/p:spacer&gt;
  
                  &lt;p:commandButton action="#{login.loginProject}" value="Login" update="loginForm" ajax="true"&gt;&lt;/p:commandButton&gt;
  
              &lt;/h:panelGrid&gt;
  
          &lt;/p:panel&gt;
  
      &lt;/h:form&gt;
  
  &lt;/h:body&gt; 
  </code></pre>
  
  <p>my web.xml</p>
  
  <pre><code>&lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&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;/servlet&gt;
   &lt;context-param&gt;
      &lt;param-name&gt;primefaces.THEME&lt;/param-name&gt;
      &lt;param-value&gt;#{login.theme}&lt;/param-value&gt;
  &lt;/context-param&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;session-config&gt;
      &lt;session-timeout&gt;
          30
      &lt;/session-timeout&gt;
  &lt;/session-config&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;login.xhtml&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  </code></pre>
  
  <p></p>
  
  <p>and my project structure:
  ![project structure]: (<a href="http://imgur.com/YT5F4jk" rel="nofollow">http://imgur.com/YT5F4jk</a>)</p>
  
  <p>What can be the reason for this error?</p>
  
  <p>I didnt change anyhting at all, just played with servlet-mapping from *.xhtml to *.jsf etc. Just more errors occured, but when i returned it to be *.xhtml the webapp is deploying welcome-file witch sorce code in firefox is like this:</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"&gt;
  &lt;h:head&gt;
      &lt;title&gt;login&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;        
      &lt;h:form id="loginForm"&gt;          
          &lt;p:growl id="msg" showDetail="true" life="3000" /&gt;
          &lt;p:panel header="Login" style="width: 360px; margin-left:35%; margin-right:45%; margin-top:15%"&gt;
  
              &lt;h:panelGrid id="loginPanel" columns="2"&gt;
  
                  &lt;h:outputText value="Username" /&gt;
  
                  &lt;p:inputText id="username" value="#{login.login}" &gt;&lt;/p:inputText&gt;
  
                  &lt;p:spacer&gt;&lt;/p:spacer&gt;
  
                  &lt;p:message for="username" &gt;&lt;/p:message&gt;
  
                  &lt;h:outputText value="Password" /&gt;
  
                  &lt;p:password id="password" value="#{login.password}"  feedback="false"&gt;&lt;/p:password&gt;
  
                  &lt;p:spacer&gt;&lt;/p:spacer&gt;
  
                  &lt;p:message for="password"&gt;&lt;/p:message&gt;
  
                  &lt;p:spacer&gt;&lt;/p:spacer&gt;
  
                  &lt;p:commandButton action="#{login.loginProject}" value="Login" update="loginForm" ajax="true"&gt;&lt;/p:commandButton&gt;
  
              &lt;/h:panelGrid&gt;
  
          &lt;/p:panel&gt;
  
      &lt;/h:form&gt;
  
  &lt;/h:body&gt; 
  </code></pre>
  
  <p>
  and in Chrom its html:</p>
  
  <pre><code>&lt;td&gt;Username&lt;/td&gt;&lt;td&gt;&lt;input id="loginForm:username" name="loginForm:username" type="text" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /&gt;&lt;script id="loginForm:username_s" type="text/javascript"&gt;PrimeFaces.cw("InputText","widget_loginForm_username",{id:"loginForm:username",widgetVar:"widget_loginForm_username"});&lt;/script&gt;&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>Any way when I try to log in II get this message:
   ![unable to find matching navigation case]: (<a href="http://imgur.com/PS6IC33" rel="nofollow">http://imgur.com/PS6IC33</a>)</p>
  
  <p>my Login.java:</p>
  
  <pre><code>public class Login implements Serializable {
  
      private static final long serialVersionUID = 1L;
      private String password;    
      private String message;
      private String login;
      private Object id;
      private Object bg_color;
      private Object theme = "cupertino";
  
      public String getMessage() {
          return message;
      }
  
      public void setMessage(String message) {
          this.message = message;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public String getLogin() {
          return login;
      }
  
      public void setLogin(String login) {
          this.login = login;
      }
      @ManagedProperty("#{userDAO}")
      private UserDAO session;
  
      public void setSession(UserDAO session)
      {
          this.session=session;
      }
      public String loginProject() 
      {   
          boolean result = session.login(login, password);
          if (result) {
              // get Http Session and store username
              HttpSession session = Util.getSession();
              session.setAttribute("username", login);
              //UserView.init(id);
              setId(session.getAttribute("id"));
              setBg_color(session.getAttribute("bg_color"));
              setTheme(session.getAttribute("theme"));
  
              return "home";
          } else {
  
              FacesContext.getCurrentInstance().addMessage(
                      null,
                      new FacesMessage(FacesMessage.SEVERITY_WARN,
                      "Invalid Login!",
                      "Please Try Again!"));
  
              // invalidate session, and redirect to other pages
  
              //message = "Invalid Login. Please Try Again!";
              return "login";
          }
      }
  
      public String logout() {
        HttpSession session = Util.getSession();
        session.invalidate();
        return "login.xhtml";
     }
  
      public Object getId() {
          return id;
      }
  
      public void setId(Object id) {
          this.id = id;
      }
  
      public Object getBg_color() {
          return bg_color;
      }
  
      public void setBg_color(Object bg_color) {
          this.bg_color = bg_color;
      }
  
      public Object getTheme() {
          return theme;
      }
  
      public void setTheme(Object theme) {
          this.theme = theme;
      }
  }
  </code></pre>