1 2 Previous Next 15 Replies Latest reply on Jan 5, 2012 10:18 AM by zorblak

    Richfaces 4 M2 problems

    jattra

      Hello, I have tried to get Richfaces 4 M2 running (using maven2) and I have these problems:

      On server startup an exception appears: ClassNotFoundException: org.ajax4jsf.Filter

       

      In richfaces 3 this class was included. In case of richfaces 4, I have to add ajax4jsf dependency.

       

      With ajax4jsf.jar it starts but on page load another exception appears:

      Error parsing [jar:file:richfaces-components-ui-4.0.0.20100826-M2.jar!/META-INF/rich.taglib.xml]

      ...

      Caused by: org.xml.sax.SAXException: Error Handling  [jar:file:richfaces-components-ui-4.0.0.20100826-M2.jar!/META-INF/rich.taglib.xml@2,256]

      ...

      Caused by: org.xml.sax.SAXParseException: Document root element "facelet-taglib", must match DOCTYPE root "null".

       

      Can anybody help, please?

        • 1. Re: Richfaces 4 M2 problems
          amarkhel

          You must remove any declarations of org.ajax4jsf.Filter from your web.xml, and delete ajax4jasf.jar from classpath, only richfaces.*.jar's needed

          • 2. Re: Richfaces 4 M2 problems
            jattra

            I had the Filter in web.xml. I removed it and it works. So, there is no configuration for richfaces needed, is it?

            • 3. Re: Richfaces 4 M2 problems
              amarkhel

              Yes, You are right.

              • 4. Re: Richfaces 4 M2 problems
                jattra

                I have moved to Richfaces M5 and integrated with JSF 2.0.3 and Spring Webflow 2.2.1. It works quite well but this exception appeares in log: java.io.FileNotFoundException: /WEB-INF/rfRes/skinning.xhtml Not Found in ExternalContext as a Resource

                 

                I suspect that it needs skinning.ecss (from richfaces lib) but I don't know why it looks for skinning.xhtml. I can post any config files if that could help to solve this. Any help is appreciated. Thanks in advance.

                • 5. Richfaces 4 M2 problems
                  nbelaevski

                  Hi,

                   

                  Please post your web.xml file content.

                  • 6. Re: Richfaces 4 M2 problems
                    jattra

                    <?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>roubenka</display-name>

                        <!-- The main config file for this Spring web application -->

                        <context-param>

                            <param-name>contextConfigLocation</param-name>

                            <param-value>/WEB-INF/applicationContext.xml</param-value>

                        </context-param>

                     

                        <!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->

                        <context-param>

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

                            <param-value>.xhtml</param-value>

                        </context-param>

                     

                        <!-- Enables special Facelets debug output during development -->

                        <context-param>

                            <param-name>facelets.DEVELOPMENT</param-name>

                            <param-value>true</param-value>

                        </context-param>

                     

                        <!-- Causes Facelets to refresh templates during development -->

                        <context-param>

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

                            <param-value>1</param-value>

                        </context-param>

                     

                            <!-- Skip comments-->

                        <context-param>

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

                            <param-value>true</param-value>

                        </context-param>

                        <!-- Loads the Spring web application context -->

                        <listener>

                            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                        </listener>

                     

                        <!-- Enforce UTF-8 Character Encoding -->

                        <filter>

                            <filter-name>charEncodingFilter</filter-name>

                            <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

                            <init-param>

                                <param-name>encoding</param-name>

                                <param-value>UTF-8</param-value>

                            </init-param>

                            <init-param>

                                <param-name>forceEncoding</param-name>

                                <param-value>true</param-value>

                            </init-param>

                        </filter>

                     

                        <filter-mapping>

                            <filter-name>charEncodingFilter</filter-name>

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

                        </filter-mapping>

                     

                        <!-- Enables Spring Security -->

                        <filter>

                            <filter-name>springSecurityFilterChain</filter-name>

                            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

                        </filter>

                     

                        <filter-mapping>

                            <filter-name>springSecurityFilterChain</filter-name>

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

                        </filter-mapping>

                     

                        <servlet>

                            <servlet-name>Resources Servlet</servlet-name>

                            <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>

                            <load-on-startup>0</load-on-startup>

                        </servlet>

                     

                        <!--

                            Map all /resources requests to the Resource Servlet for handling

                        -->

                        <servlet-mapping>

                            <servlet-name>Resources Servlet</servlet-name>

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

                        </servlet-mapping>

                     

                        <!--

                            The front controller of this Spring Web application, responsible for

                            handling all application requests

                        -->

                        <servlet>

                            <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

                            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

                            <init-param>

                                <param-name>contextConfigLocation</param-name>

                                <param-value>/WEB-INF/applicationContext.xml</param-value>

                            </init-param>

                            <load-on-startup>2</load-on-startup>

                        </servlet>

                     

                        <!-- Map all /spring requests to the Dispatcher Servlet for handling -->

                        <servlet-mapping>

                            <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

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

                        </servlet-mapping>

                     

                        <!--

                            Just here so the JSF implementation can initialize, *not* used at

                            runtime

                        -->

                        <servlet>

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

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

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

                        </servlet>

                     

                        <!-- Just here so the JSF implementation can initialize -->

                        <servlet-mapping>

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

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

                        </servlet-mapping>

                     

                        <welcome-file-list>

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

                        </welcome-file-list>

                    </web-app>

                    • 7. Re: Richfaces 4 M2 problems
                      ganga_1

                      Hi jattra,

                       

                      Even I am too using the same configuration of " Richfaces 4 M5 and integrated with JSF 2.0.3 and Spring Webflow 2.2.1".

                       

                      Having the same config in  the web.xml, But i am not getting any error as u have mentioned.

                       

                      But for me the richfaces "styling" is not getting applied.

                      Can u post a sample xhml file where the richfaces component is used and its getting rendered in the UI with "styling" too.

                       

                      Thanks in advance.

                      • 8. Re: Richfaces 4 M2 problems
                        jattra

                        Hi Gangadhar, I don't have richfaces styles applied (because of that error I suppose). And with XHTML it is quite complicated...

                        I use template:

                        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

                            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                        <html xmlns="http://www.w3.org/1999/xhtml"

                              xmlns:ui="http://java.sun.com/jsf/facelets"

                              xmlns:h="http://java.sun.com/jsf/html"

                              xmlns:f="http://java.sun.com/jsf/core"

                              xmlns:a4j="http://richfaces.org/a4j"

                              xmlns:rich="http://richfaces.org/rich"

                              xmlns:c="http://java.sun.com/jsp/jstl/core">

                         

                            <h:head>

                                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

                                <link rel="stylesheet" type="text/css" href="../style/pagetempl.css" />

                                <title><ui:insert name="title" /></title>

                            </h:head>

                         

                            <h:body>

                                <table class="MainTable">

                                    <tr class="PageTop">

                                        <td colspan="2">

                                            <ui:include src="topbar.xhtml" />

                                        </td>

                                    </tr>

                                    <tr>

                                        <td valign="top" width="240">

                                            <ui:include src="menu.xhtml" />

                                        </td>

                                        <td>

                                            <h:panelGrid columns="1" styleClass="PageBody">

                                                <ui:insert name="page" />

                                            </h:panelGrid>

                                        </td>

                                    </tr>

                                    <tr class="PageBottom" >

                                        <td>

                                        </td>

                                        <td align="right" valign="bottom">

                                        </td>

                                    </tr>

                                </table>

                            </h:body>

                        </html>

                         

                        ... it includes a few other XHTMLs but I think they do not matter.

                         

                        And a page forexample RoomList.xhtml:

                         

                        <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

                                                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                        <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                            xmlns:ui="http://java.sun.com/jsf/facelets"

                            xmlns:f="http://java.sun.com/jsf/core"

                            xmlns:h="http://java.sun.com/jsf/html"

                            xmlns:a4j="http://richfaces.org/a4j"

                            xmlns:rich="http://richfaces.org/rich"

                            template="/templates/template.xhtml"

                            >

                            <ui:define name="title">Roubenka - Místnosti</ui:define>

                            <ui:define name="page">

                                <rich:dataTable value="#{roomList}" var="room" styleClass="CommonTable" >

                                    <rich:column>

                                        <f:facet name="header">

                                            Číslo

                                        </f:facet>

                                        <h:outputText value="#{room.id}" />

                                    </rich:column>

                                    <rich:column>

                                        <f:facet name="header">

                                            Postelí

                                        </f:facet>

                                        <h:outputText value="#{room.numOfBeds}" />

                                    </rich:column>

                                    <rich:column>

                                        <f:facet name="header">

                                            Popis

                                        </f:facet>

                                        <h:outputText value="#{room.description}" />

                                    </rich:column>

                                </rich:dataTable>       

                            </ui:define>

                        </ui:composition>

                         

                         

                        But as I said before, I don't get it styled in richfaces manner and I get the error I have described in earlier post.

                        • 9. Re: Richfaces 4 M2 problems
                          ganga_1

                          Thanks for the quick reply...

                          but having no luck in loading the skin.

                          • 10. Re: Richfaces 4 M2 problems
                            franksparr

                            I'm having a similar problem with Rich Faces 4.  The first time the page loads, the Rich Faces skins/stylesheets are included in the page, and the page displays properly.  However, when I submit a form with a validation error, the page is reloaded without the skins/stylesheets.

                             

                            It's like the response chain is quitting after the validation phase and not continuing on to the Rich Faces part that included the stylesheets in the pages.

                             

                            Any ideas?

                            • 11. Re: Richfaces 4 M2 problems
                              ganga_1

                              Hi jattra,

                               

                              problem solved, its a workaround solution

                               

                              describes a workaround to get css resources loaded

                              http://stackoverflow.com/questions/4586947/resource-handler-problems-with-jsf2-richfaces4-springmvc-webflow-swf

                               

                              i.e.

                              adding this in the ***servlet.xml

                               

                              <bean name="jsfResourceHandlerHack" class="org.springframework.faces.webflow.JsfResourceRequestHandler" />

                              <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
                                 
                              <property name="order" value="1" />
                                 
                              <property name="mappings">
                                     
                              <value>
                                          /rfRes/**=jsfResourceHandlerHack
                                     
                              </value>
                                 
                              </property>
                              </bean>

                               


                              • 12. Re: Richfaces 4 M2 problems
                                jattra

                                Hi Gangadhar,

                                thank You very much. It seems that You have just solved my prob. It works.

                                • 13. Re: Richfaces 4 M2 problems
                                  zorblak

                                  Hi,

                                   

                                  I've been having problems as I've tried switching from Richfaces 3 to Richfaces 4, with it not loading the stylesheets.  I came across this answer as I searched for the error I was seeing (FileNotFoundException for /rfRes/... items), and that moved me forward a bit, but now I'm getting a different error.  I put in the jsfResourceHandlerHack items into my config, and now when I try to load a simple page with a rich:panel on it (which I'm using to test my config), instead of complaining that it can't find the /rfRes/... items, I get this error:

                                   

                                  javax.servlet.ServletException: No adapter for handler [org.springframework.faces.webflow.JsfResourceRequestHandler@1cb2d75c]: Does your handler implement a supported interface like Controller?

                                      at org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:967)

                                      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:760)

                                      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)

                                      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)

                                      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)

                                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

                                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

                                  ...

                                   

                                  Has anyone seen this?  Any idea why it doesn't like the JsfResourceRequestHandler?

                                  • 14. Re: Richfaces 4 M2 problems
                                    zorblak

                                    Replying to myself here after having done a little more research on this.  It seems that the Controller interface clashes with the HttpRequestHandler interface that JsfResourceRequestHandler implements.  Was this a rename or a migration of some kind that occurred at some point?  Is it possible I have incompatible versions of RichFaces and SpringMVC or WebFlow, or somethin' like that?  I'd love some help if anyone has any ideas, since this is preventing me from moving forward with testing for this migration.

                                    1 2 Previous Next