Error 500: Cannot Find FacesContext

I have used JSF and been able to render successfully until I start working ADF components into my ***.jsp.

I use the IBM Rational Application Developer (RAD) v7.0. And all the compilation complaints have been cleaned up.

But, when I tried to run my ***.jsp, I have the "Error 500: Cannot Find FacesContext" in the browser window. Please help before I break my head. Thanks

Here is what in my console:

[6/13/07 14:04:32:066 EDT] 00000090 ServletWrappe ISRVE0242I: [LOV] [/ADF_TEST] [/selectInputText.jsp]: Initialization successful.

[6/13/07 14:04:32:331 EDT] 00000090 ServletWrappe ESRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: /selectInputText.jsp. Exception thrown : javax.servlet.ServletException: Cannot find FacesContext

at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:660)

at com.ibm._jsp._selectInputText._jspService(_selectInputText.java:89)

at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)

at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:115)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:168)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:270)

at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)

at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)

at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)

at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)

at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)

at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)

at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)

at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

- Begin backtrace for Nested Throwables

javax.servlet.jsp.JspException: Cannot find FacesContext

at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:409)

at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:104)

at com.ibm._jsp._selectInputText._jspx_meth_f_view_0(_selectInputText.java:355)

at com.ibm._jsp._selectInputText._jspService(_selectInputText.java:81)

at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)

at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:115)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:168)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:270)

at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)

at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)

at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)

at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)

at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)

at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)

at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)

at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

[6299 byte] By [jiapei_jena] at [2007-11-27 7:35:22]
# 1
How are you invoking the request? Does the request URI match the url-pattern of the FacesServlet as definied in the web.xml?
BalusCa at 2007-7-12 19:15:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I entered http://localhost:9080/MyProject/***.jsp

And I have also tried http://localhost:9080/faces/***.jsp

http://localhost:9080/***.faces

In my web.xml, I have:

<context-param>

<param-name>javax.faces.STATE_SAVING_METHOD</param-name>

<param-value>client</param-value>

</context-param>

<context-param>

<param-name>javax.faces.CONFIG_FILES</param-name>

<param-value>/WEB-INF/faces-config.xml</param-value>

</context-param>

<context-param>

<description>

The default suffix for extension-mapped resources that contain JSF components.

Default is '.jsp'.</description>

<param-name>javax.faces.DEFAULT_SUFFIX</param-name>

<param-value>.jsp</param-value>

</context-param>

.....

.....

<listener>

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

</listener>

<servlet>

<servlet-name>Faces Servlet</servlet-name>

<servlet-class>

javax.faces.webapp.FacesServlet</servlet-class>

<load-on-startup> 1 </load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>/faces/*</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

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

</servlet-mapping>

.....

.....

jiapei_jena at 2007-7-12 19:15:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
u have to use *.jsf as url pattern in web.xml and remove two url mapping s from u r web.xml and try this one
venkatJSFa at 2007-7-12 19:15:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I followed your suggestion and removed the servlet to url mappings in my web.xml file.In the browser window, I tried http://localhost:9080/MyProject/***.jsfI got "Error 404: file cannot be found"
jiapei_jena at 2007-7-12 19:15:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...