0 Replies Latest reply on Apr 25, 2006 1:45 PM by lewkim

    Faces context not found. getResponseWriter will fail. Check

    lewkim

      I am currently evaluating JBoss for my company. Needless to say, it is not going well. I am currently experiencing an problem that seems alot of people have experienced, yet every solution I have found does not work for me.

      I am getting the following error:
      Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
       <context-param>
       <param-name>javax.faces.CONFIG_FILES</param-name>
       <param-value>/WEB-INF/faces-config.xml</param-value>
       </context-param>
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>0</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.faces</url-pattern>
       </servlet-mapping>
      <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
      </listener>
      </web-app>
      

      I am calling my program with: http://localhost:8080/LibraryWeb/index.faces.
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      
      <faces-config >
       <navigation-rule>
       <from-view-id>/index.jsp</from-view-id>
       </navigation-rule>
       <navigation-rule>
       <description>List of books</description>
       <from-view-id>/listBooks.jsp</from-view-id>
       <navigation-case>
       <from-outcome>editBook</from-outcome>
       <to-view-id>/editBook.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
       <navigation-rule>
       <description>Add or edit a book</description>
       <from-view-id>/editBook.jsp</from-view-id>
       <navigation-case>
       <from-outcome>listBooks</from-outcome>
       <to-view-id>/listBooks.jsp</to-view-id>
       <redirect/>
       </navigation-case>
       </navigation-rule>
       <managed-bean>
       <description>BookList Bean</description>
       <managed-bean-name>bookListBean</managed-bean-name>
       <managed-bean-class>de.laliluna.tutorial.library.BookList</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
       <managed-bean>
       <description>Book Bean</description>
       <managed-bean-name>bookBean</managed-bean-name>
       <managed-bean-class>de.laliluna.tutorial.library.Book</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      </faces-config>
      

      The code for my index.jsp is:
      
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      
      <body>
       <jsp:forward page="/listBooks.faces" />
      </body>
      </html>