Meaningless Drivel is fun!*
The moose likes JSF and the fly likes java.lang.RuntimeException: Cannot find FacesContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "java.lang.RuntimeException: Cannot find FacesContext" Watch "java.lang.RuntimeException: Cannot find FacesContext" New topic
Author

java.lang.RuntimeException: Cannot find FacesContext

prabath Manjula
Greenhorn

Joined: Dec 31, 2010
Posts: 1
Please assist me

I have written a simple JSF application using Netbeans IDE. It works when I run using the IDE. But after creating the WAR file and i deployed it on apache-tomcat-6.0.16\webapps. It Gives an error as below mentioned.

-----------------

org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 17

14: <title>Login Page</title>
15: </head>
16: <body>
17: <f:view>
18: <h:form id="LoginForm">
19: <h:panelGrid id="lpg" columns="2">
20:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

java.lang.RuntimeException: Cannot find FacesContext
javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1811)
javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1628)
org.apache.jsp.login_jsp._jspx_meth_f_005fview_005f0(login_jsp.java:118)


--------------------


please assist me to solve this issue. I visited the solutions for the same issue. As it mentioned I addedd this

<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

thanks

Prabath

Cesar Loachamin
Ranch Hand

Joined: Dec 25, 2010
Posts: 90

Hi Prabath

It appears that you have a problem with jsf libraries, verifies that in the war that was generated in the WEB-INF/lib folder are the jsf jars: jsf-api, jsf-impl.

Regards

Cesar


When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
Since there is a JSF class in the stack trace (that is trying to find the FaceContext) I think that the point Cesar made is not the issue. But you should still check that the libraries he mentioned are present of course!

But you say that the error is shown right after the war is deployed. Are you sure? It looks like the error is actually shown WHEN you try to go to login.jsp. So if that is the case be sure to include all the necessary information when describing your problem from now on.

If the FacesContext is not found maybe there was already a problem in the deployment and there might be a more important error message in the logs at the deployment stage! In that case the error is probably in catalina.log
tun lynn
Greenhorn

Joined: Apr 26, 2012
Posts: 3
I too has java.lang.RuntimeException: Cannot find FacesContext problem...in my case I already have those jars in lib folder...deployment is also OK...

I am not sure I am using the corredt URL or the web.xml setting is off....not sure which?!!

here is my posting on the subject

http://www.coderanch.com/t/579213/JSF/java/url

can anybody help please ??
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

Please don't dredge up old dead threads just to repeat a question you've already asked. It clutters up the forum.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.RuntimeException: Cannot find FacesContext
 
Similar Threads
I am so tired just getting start in jsf please help me please
Cannot find FacesContext
jsf problem , java.lang.RuntimeException: Cannot find FacesContext error
java.lang.RuntimeException: Cannot find FacesContext
while creating jsf project