title: Eclipse & JSF & Tomcat 6: "FacesContext not found"
body: <p>Using Eclipse Helios, I tried to start a JSF based project.</p>
  
  <p>After having created a new workspace, I installed the web-tools-platform stuff. All using the "Install New Software" in the Help menu, this worked quite well.</p>
  
  <p>To start developping for my project, I created a new project using the wizard, with which I downloaded and installed Tomcat 6.0 instance and runtime and configured it with the preset "JavaServer Faces v1.2 Project".</p>
  
  <p>I created one single index.jsp-file (again with the wizard using the JSF-template) and put a JSF-outputText on it.</p>
  
  <p>Deploy to the tomcat seems to work. When calling index.jsp in a browser, I get several times the following exception:</p>
  
  <blockquote>
    <p>29.12.2010 18:24:00 org.apache.catalina.core.StandardWrapperValve invoke
    SCHWERWIEGEND: Servlet.service() for servlet jsp threw exception
    java.lang.RuntimeException: FacesContext not found
     at javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:321)
     at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:228)
     at org.apache.jsp.login_jsp._jspx_meth_f_005fview_005f0(login_jsp.java:95)
     at org.apache.jsp.login_jsp._jspService(login_jsp.java:69)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     at java.lang.Thread.run(Thread.java:662)</p>
  </blockquote>
  
  <p>Every single step I did was a standard-clicking-through-wizards process.</p>
  
  <p>Any idea why this doesn't seem to work?</p>
  
  <p>I can easily post screenshots or file excerpts if that helps, though I don't do it here to avoid overloading the question.</p>
  
  <p><hr>
  <strong><em>Edit: web.xml</em></strong> This file comes directly from eclipse, i left it unmodified except that I removed the description-tags in order to shorten the whole stuff:</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://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"&gt;
    &lt;display-name&gt;Stundenplan&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&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;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.localizationContext&lt;/param-name&gt;
      &lt;param-value&gt;resources.application&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
      &lt;param-value&gt;client&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;org.apache.myfaces.ALLOW_JAVASCRIPT&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;org.apache.myfaces.PRETTY_HTML&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;org.apache.myfaces.DETECT_JAVASCRIPT&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;org.apache.myfaces.AUTO_SCROLL&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;org.apache.myfaces.webapp.StartupServletContextListener&lt;/listener-class&gt;
    &lt;/listener&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Already tried setting the url-pattern to <code>&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</code> but then it's coming up with the exception "java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config"</p>
  
  <hr>
  
  <p>Thanks and regards, Tobias</p>