Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSF and the fly likes jsf problem , java.lang.RuntimeException: Cannot find FacesContext error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf problem , java.lang.RuntimeException: Cannot find FacesContext error" Watch "jsf problem , java.lang.RuntimeException: Cannot find FacesContext error" New topic
Author

jsf problem , java.lang.RuntimeException: Cannot find FacesContext error

stefano corna
Greenhorn

Joined: Sep 08, 2010
Posts: 4
hi,
i just started work with jsf with eclipse and i need help to solve a problem.
i use Eclipse Elios, Tomcat 6.0 and JFS 1.2 (SUN version)
heres what i done
i created a new dynamic web project with eclipse, with javaserver faces 1.2 runtime and i added the relative jars (jsf-api jsf-impl and jstl-api-1.2).
i created a new jsp page with "New javaserver faces (JSF) Page (html)" template and added in it a simple empty table from the palette.
i generated the war fime and mounted on apache tomcat but it give me this error:
java.lang.RuntimeException: Cannot find FacesContext

follow the full error trace and java code in my project:


ERROR:



JSP FILE:



web.xml and faces-config.xml



someone have idea of what that error mean and what i should do?
tnx in advice.
regards.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17039
    
  26

It looks like you're confusing the resource path with the URL. Only URLs that match the mapping(s) you set up for the FacesServlet in web.xml are routed to the FacesServlet, and only the FacesServlet provides the FacesContext.

In other words, instead of asking for the resource ("/mywebapp/prova.jsp"), you need to ask for the URL ("http:/mywebapp/faces/prova.jsp")

An IDE is no substitute for an Intelligent Developer.
stefano corna
Greenhorn

Joined: Sep 08, 2010
Posts: 4
Tim Holloway wrote:It looks like you're confusing the resource path with the URL. Only URLs that match the mapping(s) you set up for the FacesServlet in web.xml are routed to the FacesServlet, and only the FacesServlet provides the FacesContext.

In other words, instead of asking for the resource ("/mywebapp/prova.jsp"), you need to ask for the URL ("http:/mywebapp/faces/prova.jsp")


ty now it works
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: jsf problem , java.lang.RuntimeException: Cannot find FacesContext error
 
It's not a secret anymore!