M F
M F

Reputation: 323

Getting 404 Status when trying to request JSF page

I have difficulties in running my eclipse jsf test project. I am using eclipse kepler, apache tomcat 7.0 and JSF 2.1.9. Whenever I try to request my helloWorld.xhtml (url /localhost/helloWorldJSF/helloWorld.xhtml), it brings me to the 404 status saying that the requested resource is not available but I do not understand why.

Here is my web.xml:

<?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_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>HelloJSF</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <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>*.xhtml</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>

And my helloWorldJSF.xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html">

<h:head>
    <title>Hello JSF</title>
</h:head>
<h:body>
    <h:form id="helloForm">
        <h:outputText value="Hello JSF"></h:outputText>
    </h:form>
</h:body>

What am I doing wrong? I have set the according libraries in the settings (JSF 2.1.9). The faces-config.xml also refers to version 2.1.

Thanks in advance!

Upvotes: 0

Views: 2184

Answers (1)

M F
M F

Reputation: 323

I solved the problem by removing the server and adding a new server configuration.

Upvotes: 1

Related Questions