In IntelliJIdea, i’ve created a little application with just default pages auto created by ide. I’ve added two frameworks: spring (3) and JSF 2. The app level is java ee 2.5, because I want to deploy on a Tomcat 6.0.
I installed an Apache Tomcat 6.0, created an administrator user, and tested, it works.
But when I deploy the simple application, it seems to deploy it correctly, but accessing it, the browser gives the error:
Simple jsp page
12: <body>
13:
14: f:view>
15:
16:
17:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:519)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.RuntimeException: FacesContext not found
....
The JSF component is complaining that the
FacesContextcannot be found. TheFacesServletis the one responsible for creating it. So it has clearly not run. You need to ensure that the request URL as you entered in the browser address bar matches the URL pattern of theFacesServletas it is been definied in the webapp’sweb.xmlfile (and that it is been definied in theweb.xml). If it is for examplethen you need to ensure that the request URL is
and thus not
If the request URL matches the URL pattern of the
FacesServlet, then it will be invoked and it will do all the JSF jobs.Unrelated to the problem: why the choice for JSP when you’re using JSF2? Why not using its superior successor Facelets instead?