JSF 404 Error

Hello,

I have googled a long time, but I couldn't find a solution to my problem.

I am developing my first JSF 1.2 Application in combination with Tomcat 6 with Eclipse.

I have imported all libraries needed (jsf_api, jsf_impl, jstl etc.). When I call a JSF page, I get a 404 resource not found error.

Normal JSP projects work perfectly.

These are the contents of 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_2_5.xsd" id="WebApp_ID" version="2.5">

<display-name>test</display-name>

<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>

</servlet-mapping>

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

</web-app>

Basically I followed this tutorial to set up my first jsf app: http://www.eclipse.org/webtools/jsf/dev_resource/JSFTutorial-RC3/JSFTools_tutorial.html .

There are two versions, one with JSF 1.1 support which worked, and one with JSF 1.2 support which didn't work.

Thanks in advance,

Tobias

Message was edited by:

tobiasgp

[1898 byte] By [tobiasgpa] at [2007-11-27 11:05:48]
# 1

> When I call a JSF page, I get a

> 404 resource not found error.

What URL specifically are you using?

Are there any messages in the logs?

RaymondDeCampoa at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I haven't found any error messages in the logs.

Specifically, I'm using the follwing url: http://localhost/test/test.jsf (for the test.jsp file which is being mapped to test.jsf)

tobiasgpa at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

see log carefully.

it may contains one record with something similar:

context loading error for [test] ...

web.xml look like good

necromancer15a at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I have found the following error messages in Tomcat's console output:

INFO: Initializing Sun's JavaServer Faces implementation (1.2-b20-FCS) for context '/test'

19.07.2007 18:38:40 com.sun.faces.config.ConfigureListener contextInitialized

INFO: Completed initializing Sun's JavaServer Faces implementation (1.2-b20-FCS) for context '/test'

19.07.2007 18:38:40 org.apache.catalina.core.StandardContext listenerStart

SCHWERWIEGEND: Exception sending context initialized event to listener instance of class com.sun.faces.config.GlassFishConfigureListener

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

at org.ajax4jsf.framework.DebugLifecycleFactory.<clinit>(DebugLifecycleFactory.java:39)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:567)

at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:460)

at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)

at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:1106)

at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:766)

at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:529)

at com.sun.faces.config.GlassFishConfigureListener.contextInitialized(GlassFishConfigureListener.java:47)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

at org.apache.catalina.core.StandardService.start(StandardService.java:516)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

at org.apache.catalina.startup.Catalina.start(Catalina.java:566)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

19.07.2007 18:38:40 org.apache.catalina.core.StandardContext start

SCHWERWIEGEND: Error listenerStart

19.07.2007 18:38:40 org.apache.catalina.core.StandardContext start

SCHWERWIEGEND: Context [/test] startup failed due to previous errors

SCHWERWIEGEND = Fatal ;-)

I have just removed AJAX4JSF and it works! How shall I go on if I would like to use it?

Message was edited by:

tobiasgp

Message was edited by:

tobiasgp

tobiasgpa at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

UPDATE: If I use the commons classes from JSF 1.1 I am able to use AJAX4JSF. I am not sure if this is a good solution, because I'm using JSF 1.2 which has no commons jars included. What do you think?

tobiasgpa at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

It's clear something has a dependency on commons-logging. If you are concerned about the commons jars from the 1.1 implementation, just download them directly from apache at http://jakarta.apache.org.

RaymondDeCampoa at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

JSF RI 1.2 - 1.2_04 P02 doesn't rely on the commons classes, at least the org.apache versions. In order to minimize the impact to GlassFish, the RI includes com.sun.org.apache version of these same classes. This means the RI doesn't include the org.apache versions anymore.

It looks like a4j has dependencies on these classes, hence the error you're seeing.

For what it's worth, JSF RI 1.2_05 will have no external dependencies at all (org.apache or com.sun.org.apache).

rlubkea at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

I think that I have solved the problems now. Thanks for the great support!

tobiasgpa at 2007-7-29 13:11:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...