myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simon <>
Subject Re: Cannot find FacesContext at javax.faces.webapp
Date Mon, 18 Aug 2008 16:49:38 GMT

On Sat, 2008-08-16 at 23:37 +0300, Daniel wrote:
> Hello, i have a problem loading my jsf pages (i am using richfaces).
> I am using jetty server, as maven plugin... Also i have made a test, a
> classic one loading inputme, and greetings. When i had forward my
> index to that pages it worked without any problems.
> I am trying to include a page in another like this :

I don't think the problem is anything to do with the include.

> <filter-mapping>
> <filter-name>sitemesh</filter-name>
> <url-pattern>/*</url-pattern>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>FORWARD</dispatcher>
> </filter-mapping>
> <listener>
> <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
> </listener>

> <!-- <listener>
> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
> </listener>-->
> <!-- Faces Servlet -->
> <servlet>
> <servlet-name>Faces Servlet</servlet-name>
> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <!-- Faces Servlet Mapping -->
> <servlet-mapping>
> <servlet-name>Faces Servlet</servlet-name>
> <url-pattern>*.jsf</url-pattern>
> </servlet-mapping>

> my arror is :
> An Error has occurred in this application. java.lang.RuntimeException:
> Cannot find FacesContext at
> javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(

>  at
> com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter( at org.mortbay.jetty.servlet.ServletHandler

Firstly, you're running Sun's JSF implementation. We can't give you any
detailed help on that. But here's some possible pointers anyway:

In order for a JSF page to work, the request needs to execute the
FacesServlet. If it doesn't, then you get exactly this problem: no
FacesContext object gets created.

And your stacktrace shows clearly that the FacesServlet is not getting

You are using SiteMesh here. Combining SiteMesh with JSF is not easy. It
is almost certainly your use of SiteMesh here that is causing the jsp
page to run without having executed the FacesServlet.

I suggest you search the web for information on combining SiteMesh with
JSF. And if you have any followup questions, make sure you point out
that you are using SiteMesh; it makes a world of difference.


View raw message