1 Reply Latest reply on Jun 19, 2007 6:51 PM by Kevin Lester

    Error using Ajax4JSF and Struts2

    Kevin Lester Newbie

      I am getting an error using Ajax4JSF on a Struts 2.0 page. According to the Struts2 documentation, Struts2 is supposed to support JSF components, so I created a simple Struts2 app and a simple JSF page to test Ajax4JSF (using RichFaces). When I browse to the page containing the component, I get the following error:

      javax.faces.FacesException: Resources framework is not initialised, check web.xml for Filter configuration
       org.ajax4jsf.framework.resource.ResourceBuilderImpl.getWebXml(ResourceBuilderImpl.java:107)


      I was able to use other JSF components in my test app, and they all work fine. When I test RichFaces components, however, I get the above Ajax4JSF error. My web.xml is below.

      <?xml version="1.0"?>
       <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
       <display-name>Struts2-JSF</display-name>
      
       <filter>
       <display-name>Ajax4jsf Filter</display-name>
       <filter-name>ajax4jsf</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
      <!-- Context Parameters -->
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.ajax4jsf.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
      
      <!-- End Context Parameters -->
      
       <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
      
      
       <!-- Faces Servlet -->
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- Faces Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.action</url-pattern>
       </servlet-mapping>
      
      
       <!-- Start Struts Filter -->
       <filter>
       <filter-name>struts2</filter-name>
       <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>struts2</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
       <!-- End Struts Filter -->
      
       </web-app>


      Any ideas on the cause of this? Is there simply a problem running Ajax4JSF in the Struts2 framework?