1 Reply Latest reply on Jul 28, 2011 2:52 AM by sureshbabu C

    Cannot find FacesContext exception with struts2

    sureshbabu C Newbie

      Hi,

       

      I am developing a small project with richfaces 3.3.3 with struts 2 in jboss 4.2.3 GA.When i am trying to access the JSF page I am getting Cannot find FacesContext runtime exception in the log.I put the same application in Jboss 5.1.0 GA also.same exception.I have all the JAR in my classpath.Anybody please help me to get rid of this...

       

      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>SampleRichFaces</display-name>

        <context-param>

          <param-name>javax.faces.CONFIG_FILES</param-name>

          <param-value>/WEB-INF/faces-config.xml</param-value>

        </context-param>

        <context-param>

          <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

          <param-value>server</param-value>

        </context-param>

        <context-param>

          <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>

          <param-value>com.sun.facelets.FaceletViewHandler</param-value>

        </context-param>

        <context-param>

          <param-name>org.ajax4jsf.SKIN</param-name>

          <param-value>blueSky</param-value>

        </context-param>

        <context-param>

          <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>

          <param-value>Mojarra-1.2</param-value>

        </context-param>

        <filter>

          <display-name>Ajax4jsf Filter</display-name>

          <filter-name>richfaces</filter-name>

          <filter-class>org.ajax4jsf.Filter</filter-class>

        </filter>

        <filter>

          <filter-name>struts2</filter-name>

          <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

        </filter>

        <filter-mapping>

          <filter-name>richfaces</filter-name>

          <servlet-name>Faces Servlet</servlet-name>

          <dispatcher>REQUEST</dispatcher>

          <dispatcher>FORWARD</dispatcher>

          <dispatcher>INCLUDE</dispatcher>

        </filter-mapping>

        <filter-mapping>

          <filter-name>struts2</filter-name>

          <url-pattern>/*</url-pattern>

        </filter-mapping>

        <listener>

          <listener-class>com.sun.faces.config.ConfigureListener</listener-class>

        </listener>

        <servlet>

          <servlet-name>Faces Servlet</servlet-name>

          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

          <load-on-startup>1</load-on-startup>

        </servlet>

        <servlet>

          <servlet-name>JspSupportServlet</servlet-name>

          <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>

          <load-on-startup>1</load-on-startup>

        </servlet>

        <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>*.action</url-pattern>

        </servlet-mapping>

        <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>/faces/*</url-pattern>

        </servlet-mapping>

        <login-config>

          <auth-method>BASIC</auth-method>

        </login-config>

        <welcome-file-list>

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

        </welcome-file-list>

      </web-app>

       

      in index.jsp I am redirecting to LoginAction class.Index.jsp is a pure JSP having redirection logic.

       

      My struts.xml

       

      <?xml version="1.0" encoding="UTF-8" ?>

      <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">

       

      <struts>

       

      <package name="action" namespace="/" extends="struts-default">

       

      <action name="LoginAction" class="action.LoginAction">

          <exception-mapping exception="java.lang.Exception"  result="exception" />

                  <result name="success">/WEB-INF/jsp/welcome.jsp</result>

                  <result name="exception">/WEB-INF/jsp/error.jsp</result>

          </action>

       

      <action name="WelcomeAction" class="action.WelcomeAction">

          <exception-mapping exception="java.lang.Exception"  result="exception" />

                  <result name="success">/WEB-INF/jsp/success.jsp</result>

                  <result name="exception">/WEB-INF/jsp/error.jsp</result>

          </action>

      </package>

       

      </struts>