开发者

IntelliJIdea, error in deployment of spring + JSF application

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.Js开发者_JAVA技巧pServletWrapper.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
....


java.lang.RuntimeException: FacesContext not found

The JSF component is complaining that the FacesContext cannot be found. The FacesServlet is 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 the FacesServlet as it is been definied in the webapp's web.xml file (and that it is been definied in the web.xml). If it is for example

<url-pattern>*.jsf</url-pattern>

then you need to ensure that the request URL is

http://localhost:8080/contextname/page.jsf

and thus not

http://localhost:8080/contextname/page.jsp

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?


I encountered the same problem. The solution for me was to use the URL "http://localhost:8080/index.faces".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜