facebook

javax.servlet.ServletException: Cannot find FacesContext

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #262597 Reply

    lhale
    Participant

    I’ve been at this problem described in this thread for days now. I’ve tried all the tricks mentioned here and all the tricks pointed to on the Sun site to ameliorate the problem of getting your JSF tutorial to work on jBoss 4.0.5 using the 1.1.4 faces libraries. The problem I’m having is centered exactly on the references to the javax.faces.application.FacesMessage and javax.faces.context.FacesContext found in the UserBean class (documented in your tutorial). BTW – I couldn;t help but NOTICE that your download of this project DOESN’T have any references to these two classes – care to clue me in why that might be? Could it be that you removed these so that you didn’t have the same problem I’m running into? Let me know.

    To rehash what exactly my problem is: here it is, just like the original poster:

    root cause

    javax.faces.FacesException: Unresolved compilation problems:
    The import javax.faces cannot be resolved
    The import javax.faces cannot be resolved
    FacesContext cannot be resolved to a type
    FacesContext cannot be resolved
    FacesMessage cannot be resolved to a type
    FacesMessage cannot be resolved to a type

    org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
    org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
    org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    I got to believe it’s some kind of magical faces context initialization that I need to do for the latest flavor of the faces stuff. But I have another faces project that seems to work with no apparent magic, but that project does not reference those two classes noted above (once again – what’s so special about them???)

    Do not ask me if I tried something that has already been discussed – I’ve tried EVERYTHING that was discussed, to no avail and anything else I could find that remotely might have a chance of fixing this problem. Is there a way that I can upload my whole project? I believe that is the only way you’ll be able to help me out on this on (I am NOT a newbie).

    — Larry H

    #262613 Reply

    Riyad Kalla
    Member

    Larry,
    To jump right to the cause sending us the project will probably be the fastest. Please do the following:

    1) File > Export > Archive, and export your project to a ZIP file.
    2) Email the ZIP file as an attachment to support@genuitec.com ATTN Riyad, with a link to this thread so I know why I’m getting the file.
    3) BE sure to include steps on how to reproduce the problem. For example, deploy project to Tomcat, and click a certain link or something like that.

    I’ll evaluate the project and let you know what I find.

    #271374 Reply

    amir55
    Participant

    23:58:01,375 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Cannot find FacesContext
    at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:399)
    at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
    at org.apache.jsp.index_jsp._jspx_meth_f_view_0(index_jsp.java:81)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:57)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke
    hi all
    it is really bothering me for the last 4 months to find a way from my consecutive errors using jsf-spring intergration on my Jboss and mysql.

    now the last error is below. I do not want to choose another IDE as I bought fully licensed this IDE
    this time stack errors is this
    (StandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:595)

    #273977 Reply

    @cmmst82 wrote:

    Ok, I celebrated a little quick. All the errors in the build are gone. Everything compiled. Now, when I go to view the page I am getting that javax.servelt… error that I was getting before. The stacktrace is:

    javax.servlet.ServletException: Cannot find FacesContext
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.userLogin_jsp._jspService(userLogin_jsp.java:97)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

    root cause

    javax.servlet.jsp.JspException: Cannot find FacesContext
    javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:405)
    com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
    org.apache.jsp.userLogin_jsp._jspx_meth_f_view_0(userLogin_jsp.java:112)
    org.apache.jsp.userLogin_jsp._jspService(userLogin_jsp.java:87)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

    I appreciate all your help, thanks.

    #274007 Reply

    Riyad Kalla
    Member

    vijay,
    You will get that error when you don’t use the extension to access the page that is mapped to JSF. For example, index.faces instead of index.jsp.

    #274995 Reply

    Michaelcford
    Member

    in the web.xml add the following mapping
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

    then in the index.jsp do a forward.
    <jsp:forward page=”faces/welcome.jsp”/>

    in your faces-config
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>welcome</from-outcome>
    <to-view-id>/welcome.jsp</to-view-id>
    <redirect/>
    </navigation-case>

    from this point forward the control is within faces.
    I had the same issue and found this in a tutoral I was working on.

Viewing 6 posts - 16 through 21 (of 21 total)
Reply To: javax.servlet.ServletException: Cannot find FacesContext

You must be logged in to post in the forum log in