2 Replies Latest reply on Sep 12, 2010 9:44 PM by dmd anfini

    Myfaces 2.0.1 + RichFaces 3.3.3 + Tomcat 6 = blank page

    dmd anfini Newbie

      Hi, I'm learning JSF 2.0 and decided to test a simple hello world like application using Myfaces 2.0.1 + RichFaces 3.3.3 + Tomcat 6.

       

      All my pages are returned blank by the server. Need help on how make it work.

       

      I have the following libs added to the webapp:

       

      for Myfaces 2.0.1:

      • commons-beanutils-1.7.0.jar
      • commons-codec-1.3.jar
      • commons-collections-3.2.jar
      • commons-digester-1.8.jar
      • commons-discovery-0.4.jar
      • commons-logging-1.1.1.jar
      • myfaces-api-2.0.1.jar
      • myfaces-impl-2.0.1.jar
      • jstl-api-1.2.jar
      • jstl-impl-1.2.jar

       

      for RichFaces 3.3.3:

      • jhighlight-1.0.jar
      • richfaces-api-3.3.3.Final.jar
      • richfaces-impl-jsf2-3.3.3.Final.jar
      • richfaces-ui-3.3.3.Final.jar

       

      some of the needed libs for RichFaces 3.3.3 are already included in the libs for Myfaces 2.0.1

       

      all these libs are under WEB-INF/lib

       

      here is the 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_Test-Myfaces2-and-RichFaces333" version="2.5">
        
        <display-name>Test-Myfaces2-and-RichFaces333</display-name>
        
        <welcome-file-list>
          <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
        
        <context-param>
          <param-name>javax.faces.PROJECT_STAGE</param-name>
          <param-value>Development</param-value>
        </context-param>
        
        <!-- Plugging the "Blue Sky" skin into the project -->
         <context-param>
            <param-name>org.richfaces.SKIN</param-name>
            <param-value>blueSky</param-value>
         </context-param>
         
         <!-- Making the RichFaces skin spread to standard HTML controls -->
         <context-param>
            <param-name>org.richfaces.CONTROL_SKINNING</param-name>
            <param-value>enable</param-value>
         </context-param>
      
         <!-- Defining and mapping the RichFaces filter -->
         <filter>
            <display-name>RichFaces Filter</display-name>
            <filter-name>richfaces</filter-name>
            <filter-class>org.ajax4jsf.Filter</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>
         
         <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        </servlet>  
        <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.jsf</url-pattern>
        </servlet-mapping>
        
      </web-app>
      

       

      here is faces-config.xml

       

      <?xml version="1.0" encoding="UTF-8"?>   
      <faces-config 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-facesconfig_2_0.xsd" 
            version="2.0">
         
      </faces-config>
      

       

      my app has no managed beans, in fact no java classes yet. It has only 3 documents:

       

      index.jsp:

       

      <% response.sendRedirect("login.jsf"); %>
      

       

      page-template.xhtml

       

      <?xml version="1.0" encoding="UTF-8" ?>
      <!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">
         <ui:insert name="page_content"></ui:insert>
      </html>
      

       

      login.xhtml

       

      <ui:composition xmlns="http://www.w3.org/1999/xhtml" 
            xmlns:h="http://java.sun.com/jsf/html" 
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich"
            template="page-template.xhtml">
      <ui:define name="page_content">
      <h:head>   
      </h:head>
      <h:body>
         Hello World
         <h:form>
            <h:outputText value="username:"/> 
            <h:inputText id="username" value=""/> <br/>
            <h:outputText value="password:"/> 
            <h:inputSecret id="password" redisplay="false" 
                  value=""/> <br/>
         </h:form>
      </h:body>
      </ui:define>
      </ui:composition>
      

       

      The application starts without any errors, here is the console output in Eclipse

       

      12/09/2010 18:53:58 org.apache.catalina.core.AprLifecycleListener init
      INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\Common Files\Teleca Shared;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Java\jre6\bin;C:\Program Files\Java\jdk1.6.0_20\bin;%LUXRENDER_ROOT%
      12/09/2010 18:53:58 org.apache.tomcat.util.digester.SetPropertiesRule begin
      WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Test-Myfaces2-and-RichFaces333' did not find a matching property.
      12/09/2010 18:53:58 org.apache.tomcat.util.digester.SetPropertiesRule begin
      WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:AccessControl' did not find a matching property.
      12/09/2010 18:53:58 org.apache.coyote.http11.Http11Protocol init
      INFO: Initializing Coyote HTTP/1.1 on http-8080
      12/09/2010 18:53:59 org.apache.coyote.http11.Http11Protocol init
      INFO: Initializing Coyote HTTP/1.1 on http-8443
      12/09/2010 18:53:59 org.apache.catalina.startup.Catalina load
      INFO: Initialization processed in 1014 ms
      12/09/2010 18:53:59 org.apache.catalina.core.StandardService start
      INFO: Starting service Catalina
      12/09/2010 18:53:59 org.apache.catalina.core.StandardEngine start
      INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.PRETTY_HTML' found, using default value true
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.ALLOW_JAVASCRIPT' found, using default value true
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON' found, using default value false
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS' found, using default value false
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE' found, using default value false
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, using default value true
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.RENDER_VIEWSTATE_ID' found, using default value true
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.STRICT_XHTML_LINKS' found, using default value true
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getLongInitParameter
      INFO: No context init parameter 'org.apache.myfaces.CONFIG_REFRESH_PERIOD' found, using default value 2
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.VIEWSTATE_JAVASCRIPT' found, using default value false
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getStringInitParameter
      INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS' found, using default value auto
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE' found, using default value false
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.VALIDATE_XML' found, using default value false
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
      INFO: No context init parameter 'org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG' found, using default value true
      12/09/2010 18:53:59 org.apache.myfaces.shared_impl.config.MyfacesConfig createAndInitializeMyFacesConfig
      INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
      12/09/2010 18:53:59 org.apache.myfaces.config.FacesConfigurator feedStandardConfig
      INFO: Reading standard config META-INF/standard-faces-config.xml
      12/09/2010 18:53:59 org.apache.myfaces.config.FacesConfigurator addClassloaderConfigurations
      INFO: Reading config : jar:file:/C:/Users/Anfini/anfini%20ltda/projetos/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Test-Myfaces2-and-RichFaces333/WEB-INF/lib/richfaces-impl-jsf2-3.3.3.Final.jar!/META-INF/ajax-context.faces-config.xml
      12/09/2010 18:53:59 org.apache.myfaces.config.FacesConfigurator addClassloaderConfigurations
      INFO: Reading config : jar:file:/C:/Users/Anfini/anfini%20ltda/projetos/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Test-Myfaces2-and-RichFaces333/WEB-INF/lib/richfaces-impl-jsf2-3.3.3.Final.jar!/META-INF/faces-config.xml
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator addClassloaderConfigurations
      INFO: Reading config : jar:file:/C:/Users/Anfini/anfini%20ltda/projetos/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Test-Myfaces2-and-RichFaces333/WEB-INF/lib/richfaces-ui-3.3.3.Final.jar!/META-INF/faces-config.xml
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator getWebAppConfig
      INFO: Reading config /WEB-INF/faces-config.xml
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: Starting up MyFaces-package : myfaces-api in version : 2.0.1 from path : file:/C:/Users/Anfini/anfini%20ltda/projetos/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Test-Myfaces2-and-RichFaces333/WEB-INF/lib/myfaces-api-2.0.1.jar
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: Starting up MyFaces-package : myfaces-impl in version : 2.0.1 from path : file:/C:/Users/Anfini/anfini%20ltda/projetos/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Test-Myfaces2-and-RichFaces333/WEB-INF/lib/myfaces-impl-2.0.1.jar
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : tomahawk not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : tomahawk12 not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : tomahawk-sandbox not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : tomahawk-sandbox12 not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : tomahawk-sandbox15 not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : myfaces-orchestra-core not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : myfaces-orchestra-core12 not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : trinidad-api not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : trinidad-impl not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : tobago not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : commons-el not found.
      12/09/2010 18:54:00 org.apache.myfaces.config.FacesConfigurator startLib
      INFO: MyFaces-package : jsp-api not found.
      12/09/2010 18:54:00 org.apache.myfaces.util.ExternalSpecifications isBeanValidationAvailable
      INFO: MyFaces Bean Validation support disabled
      12/09/2010 18:54:00 org.apache.myfaces.config.annotation.AnnotationConfigurator webClasses
      WARNING: AnnotationConfigurator does not found classes for annotations in /WEB-INF/classes/ . This could happen because maven jetty plugin is used (goal jetty:run). Try configure org.apache.myfaces.annotation.SCAN_PACKAGES init parameter or use jetty:run-exploded instead.
      12/09/2010 18:54:01 org.apache.myfaces.config.FacesConfigurator handleSerialFactory
      INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
      12/09/2010 18:54:01 org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
      INFO: ServletContext 'C:\Users\Anfini\anfini ltda\projetos\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Test-Myfaces2-and-RichFaces333\' initialized.
      12/09/2010 18:54:01 org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
      INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider
      12/09/2010 18:54:01 org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
      WARNING: 
      
      *******************************************************************
      *** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode.   ***
      ***                                         ^^^^^^^^^^^         ***
      *** Do NOT deploy to your live server(s) without changing this. ***
      *** See Application#getProjectStage() for more information.     ***
      *******************************************************************
      
      12/09/2010 18:54:01 org.ajax4jsf.cache.CacheManager getCacheFactory
      INFO: Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      12/09/2010 18:54:01 org.ajax4jsf.cache.LRUMapCacheFactory createCache
      INFO: Creating LRUMap cache instance using parameters: {org.richfaces.CONTROL_SKINNING=enable, org.richfaces.SKIN=blueSky, javax.faces.PROJECT_STAGE=Development}
      12/09/2010 18:54:01 org.ajax4jsf.cache.LRUMapCacheFactory createCache
      INFO: Creating LRUMap cache instance of default capacity
      12/09/2010 18:54:01 org.ajax4jsf.cache.CacheManager getCacheFactory
      INFO: Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      12/09/2010 18:54:01 org.ajax4jsf.cache.LRUMapCacheFactory createCache
      INFO: Creating LRUMap cache instance using parameters: {org.richfaces.CONTROL_SKINNING=enable, org.richfaces.SKIN=blueSky, javax.faces.PROJECT_STAGE=Development}
      12/09/2010 18:54:01 org.ajax4jsf.cache.LRUMapCacheFactory createCache
      INFO: Creating LRUMap cache instance of default capacity
      12/09/2010 18:54:01 org.apache.coyote.http11.Http11Protocol start
      INFO: Starting Coyote HTTP/1.1 on http-8080
      12/09/2010 18:54:01 org.apache.coyote.http11.Http11Protocol start
      INFO: Starting Coyote HTTP/1.1 on http-8443
      12/09/2010 18:54:01 org.apache.jk.common.ChannelSocket init
      INFO: JK: ajp13 listening on /0.0.0.0:8009
      12/09/2010 18:54:01 org.apache.jk.server.JkMain start
      INFO: Jk running ID=0 time=0/71  config=null
      12/09/2010 18:54:01 org.apache.catalina.startup.Catalina start
      INFO: Server startup in 2951 ms
      12/09/2010 18:54:03 org.apache.catalina.core.ApplicationContext log
      INFO: No state saving method defined, assuming default server state saving
      12/09/2010 18:54:03 org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider destroyInstance
      INFO: Destroy instance of org.ajax4jsf.context.AjaxContextImpl
      

       

      The login.jsf page is returned blank

       

      sorry for this big post, I hope it's enough info for getting some help

       

      Message was edited by: dmd anfini

        • 1. Re: Myfaces 2.0.1 + RichFaces 3.3.3 + Tomcat 6 = blank page
          dmd anfini Newbie

          just want to add that if I remove the richfaces filter definition and mapping from the web.xml file and delete the following richfaces libs from the project, the page is returned ok

           

          deleted libs

          • richfaces-api-3.3.3.Final.jar
          • richfaces-impl-jsf2-3.3.3.Final.jar
          • richfaces-ui-3.3.3.Final.jar

           

          but then I won't have the richfaces components. Seems like a conflict of the richfaces libs with the myfaces libs

           

          Any help is appreciated

          • 2. Re: Myfaces 2.0.1 + RichFaces 3.3.3 + Tomcat 6 = blank page
            dmd anfini Newbie

            just wanted to say that I finally made it work... seems like Myfaces 2 and RichFaces 3.3.3 have some problems working together, and some workaround is needed

             

            I found the workarounds here http://community.jboss.org/thread/148931?start=15&tstart=0 and here http://community.jboss.org/wiki/RichFaces333andJSF20

             

            I added jsf-facelets 1.1.15 to the libs (jsf-facelets.jar) and changed the 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_Test-Myfaces2-and-RichFaces333" version="2.5">
              
              <display-name>Test-Myfaces2-and-RichFaces333</display-name>
              
              <welcome-file-list>
                <welcome-file>index.jsp</welcome-file>
              </welcome-file-list>
              
              <context-param>
               <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
               <param-value>.xhtml</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>javax.faces.PROJECT_STAGE</param-name>
                <param-value>Development</param-value>
              </context-param>
              
              <!-- Plugging the "Blue Sky" skin into the project -->
               <context-param>
                  <param-name>org.richfaces.SKIN</param-name>
                  <param-value>blueSky</param-value>
               </context-param>
               
               <!-- Making the RichFaces skin spread to standard HTML controls -->
               <context-param>
                  <param-name>org.richfaces.CONTROL_SKINNING</param-name>
                  <param-value>enable</param-value>
               </context-param>
               
               <context-param>
                 <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
                 <param-value>true</param-value>
               </context-param>
               
               <context-param>
                   <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                   <param-value>com.sun.facelets.FaceletViewHandler</param-value>
               </context-param>
            
               <!-- Defining and mapping the RichFaces filter -->
               <filter>
                  <display-name>RichFaces Filter</display-name>
                  <filter-name>richfaces</filter-name>
                  <filter-class>org.ajax4jsf.Filter</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>
               
               <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              </servlet>  
              <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.jsf</url-pattern>
              </servlet-mapping>
              
            </web-app>
            

             

            and the faces-config.xml

             

            <?xml version="1.0" encoding="UTF-8"?>   
            <faces-config 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-facesconfig_2_0.xsd" 
                  version="2.0">
               <application>
                  <view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler>
               </application>
            </faces-config>