Search code examples
jsfmyfaces

JSF2( MyFaces) + hibernate + RichFaces Fails to Deploy


I've started a new project with MyFaces 2.1.8, Hibernate 4.1, tomcat 6.0.35 and RichaFaces 4.2.2.

I downloaded myFaces 2.1.8, richafces, tomcat and then in myEclipse added "Hibernate Capabilities" which added the hibernate jars. so below are the jars i have in lib:

enter image description here

and when I try to deploy it i get the following error:

Error Log (Pastebin Link)

something is very wrong here. Line 19 says:

 could not find Factory: javax.faces.application.ApplicationFactory

Is the above error to do with incompatibility of web container and tomcat? According to MyFaces 2.1.8:

JSF 2.1 requires java 1.5 or later, JSP 2.1, JSTL 1.2 and a Java Servlet 2.5 implementation.

which i think i meet so not sure why that exception is thrown.

web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.5"
     xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
     <display-name>JSFAppliction</display-name>

        <filter>
            <filter-name>Faces Servlet</filter-name>
            <filter-class>com.myNewApp.utils.SessionHandler</filter-class>
        </filter>

        <listener>
            <listener-class>com.myNewApp.utils.SessionExpiredHandler</listener-class>
        </listener>

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

        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.xhtml</url-pattern>
        </servlet-mapping>

     <context-param>
      <param-name>javax.faces.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/faces-config.xml</param-value>
     </context-param>

    </web-app>

somehow at Line 53 it's picking up Mojarra ? (INFO: Initializing Mojarra 2.0.3 (FCS b03) for context '/myNewapp_admin')!!

Is anyone able to tell what I've done wrong?


Solution

  • Did you try looking into the actual WEB-INF/lib of your generated war? Actually look in the deployment directory of Tomcat and not just in the view that the IDE presents.

    I haven't used MyEclipse for a long time, but in the past I've seen it put conflicting and erroneous jars in the WEB-INF/lib directory when using its "Add ... Capabilities" feature.

    Another cause might be that somehow the Mojarra jar or jars ended up in the /lib directory of Tomcat itself. Check that one too.