Search code examples
eclipsejsfjsf-2richfaces

HTTP 404 While Deploying a Basic Web App


I'm trying to learn the basics of RichFaces with basic tutorials over the internet. I'm Using this Development Environment:

  1. Eclipse Helios Service Release 2 (Build Id: 20110218-0911)
  2. Glassfish Open Source Edition 3.1 (Plugin Installed in eclipse).
  3. RichFaces 4.0.0 Final (jar's added in WEB-INF/lib in my project)

But, while i'm trying to deploy the webapp with Glassfish, i get the error: HTTP 404 Not Found:

The requested resource (/JSFR4/test.jsf) is not available.

I know it's an "File Not Found" error, but, the problem is that i'm getting the same error in any application what i'm doing, and i don't know what is wrong. In the Glassfish Administration Console the webapp is deployed, and, when i'm launching it from this console, i'm getting the same error.

The server.log doesn't log any error.

Can You help me? What i'm doing wrong?

Here is the web.xml generated for the project:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <description>Facelets StarterKit</description>
  <display-name>JSFR4</display-name>
  <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>facelets.REFRESH_PERIOD</param-name>
    <param-value>2</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <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>*.jsf</url-pattern>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
</web-app>

This is the faces-config generated for the project:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <description>Facelets StarterKit</description>
  <display-name>JSFR4</display-name>
  <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>facelets.REFRESH_PERIOD</param-name>
    <param-value>2</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <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>*.jsf</url-pattern>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
</web-app>

And This, is my xhtml file (Very simple)

<f:view>
    <h:head></h:head>
    <h:body>
        <rich:panel header="RichFaces Example">
            <ul>
                <li>This is an Example of Richfaces</li>
                <li>A JSF Library</li>
            </ul>
        </rich:panel>
    </h:body>
</f:view>

Thanks to Everyone


Solution

  • Your .xhtml files should normally go in the root of the context. Something like:

    webapps/
        yourapp/
            WEB-INF/
            test.xhtml
            foo.xhtml