2 Replies Latest reply on Sep 19, 2007 4:14 PM by Pratul Chakre

    Ajax4JSF and Servlet 2.3 specs?

    Pratul Chakre Newbie

      Hi,

      I am trying to use Ajax4Jsf in one of my applications. I am trying to deploy my application on Websphere 5.1. Below is the web.xml that I have for my app:

      =============================================
      <?xml version = '1.0' encoding = 'windows-1252'?>
      <!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
      <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
      </context-param>
      <context-param>
      <param-name>facelets.REFRESH_PERIOD</param-name>
      <param-value>2</param-value>
      </context-param>
      <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>true</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>com.sun.faces.validateXml</param-name>
      <param-value>true</param-value>
      </context-param>
      <context-param>
      <param-name>com.sun.faces.verifyObjects</param-name>
      <param-value>true</param-value>
      </context-param>


      <filter-name>ajax4jsf</filter-name>
      <display-name>Ajax4jsf Filter</display-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>

      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <url-pattern>*.jsf</url-pattern>
      <!--
      <*dispatcher*>REQUEST<*/dispatcher*>
      <*dispatcher*>FORWARD<*/dispatcher*>
      <*dispatcher*>INCLUDE<*/dispatcher*>
      -->
      </filter-mapping>


      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>

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

      <session-config>
      <session-timeout>35</session-timeout>
      </session-config>
      <mime-mapping>
      html
      <mime-type>text/html</mime-type>
      </mime-mapping>
      <mime-mapping>
      txt
      <mime-type>text/plain</mime-type>
      </mime-mapping>
      </web-app>

      ===============================================

      However, when I deploy and run my application, I get the following error:

      ===============================================

      javax.faces.FacesException: Resources framework is not initialised, check web.xml for Filter configuration
      at java.lang.Throwable.(Throwable.java)
      at java.lang.Throwable.(Throwable.java)
      at javax.faces.FacesException.(FacesException.java:62)
      at org.ajax4jsf.framework.resource.ResourceBuilderImpl.getWebXml(ResourceBuilderImpl.java:107)
      at org.ajax4jsf.framework.resource.ResourceBuilderImpl.getUri(ResourceBuilderImpl.java:309)
      at org.ajax4jsf.framework.resource.InternetResourceBase.getUri(InternetResourceBase.java:211)
      at org.ajax4jsf.framework.resource.BaseResourceRenderer.encodeBegin(BaseResourceRenderer.java:62)
      at org.ajax4jsf.framework.resource.OneTimeRenderer.encodeBegin(OneTimeRenderer.java:48)
      at org.ajax4jsf.framework.resource.BaseResourceRenderer.encode(BaseResourceRenderer.java:45)
      at org.ajax4jsf.framework.resource.InternetResourceBase.encode(InternetResourceBase.java:306)
      at org.ajax4jsf.framework.resource.ClientScript.encode(ClientScript.java:143)
      ===============================================

      I haven't been able to pinpoint what is missing in my web.xml.

      Due to servlet 2.3 specs, I am not able to add the tag <*dispatcher*></*dispatcher*> in the filter mapping settings (See commented code in above web.xml).( Please disregard the * before and after the tag declaration. For some strange reason, the word dispatcher would not show up on the post and hence had to resort to doing this).

      Any pointers on what I could be doing wrong here?

      Kindly note that I was able to succesfully run and deploy the code with servlet 2.4 specs and Jboss server. (obviously!!! :) )