users@glassfish.java.net

Intermittent exception thrown: Cannot find FacesContext

From: <glassfish_at_javadesktop.org>
Date: Thu, 11 Oct 2007 20:06:30 PDT

Hello Forum,

I have installed Glassfish 2-b58g and the DukesBank tutorial project on localhost. The URL serves the JSF logon page but when the submit button is hit I get an error, intermittently, which is the display of "Directory Listing For /" instead of the main.jsp. The server.log contains no errors at this point. When I use the directory list to click on main.jsp, the HTTP 500 error is displayed and the server.log contains a "javax.servlet.ServletException: Cannot find FacesContext" exception.

My request is going to the server but is not always being picked up by the FacesServlet. When the app does display main.jsp as expected, does a cached copy the JSF/MyFaces jar files exist somewhere, but when the app does display the "Directory Listing For /" is there a ClassLoader problem or conflicting jars?

The Glassfish 2-b58g does not have the jsf-api.jar in the lib, which may be a [i]missing_jars[/i] bug in this release. There is a patch available, jsf-glassfish-updater-1.2_05-20071010-NIGHTLY.jar, which does contain this jar, but the documentation does not say if this patch solves the kind of problem I have.

The URL used to call the app is: http://localhost:8080/bank/main.faces
GlassFish JSF application server needs no configuration besides the Servlet mapping. However the Glassfish App Server is not always processing my web.xml's servlet mapping.

The tutorial has mapped the FacesServlet in web.xml as below.
  <servlet>
        <display-name>FacesServlet</display-name>
        <servlet-name>FacesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
      <welcome-file>main.faces</welcome-file>
  </welcome-file-list>

Any feedback is most welcome. EMO.
[Message sent by forum member 'emo123' (emo123)]

http://forums.java.net/jive/thread.jspa?messageID=239650