4 Replies Latest reply on Nov 1, 2011 12:30 AM by cometta

    RichFaces generating blank css, Please Help!

    zahidmaqbool

      Hi,

      I have run into a rather unusual problem, all of my pages from time to time appear without any skin and none of the richfaces components will work. They styles are not applied. When I view the page source, and try to check the css by richfaces they all return empty. Please note this only happens from time to time. Like one morning it will happen, then suddenly it will be alright in the evening. Also the strange thing is that it only happens with this particular project. In this one I am using richfaces 3.2.2.
      As you can see i am also using org.richfaces.SKIN and setting it to bluesky.

      This is how the page looks like:
      [img]
      http://img243.imageshack.us/my.php?image=61093113yw1.jpg[/img]

      Here is the code:


      Home.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:s="http://jboss.com/products/seam/taglib"
       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:rich="http://richfaces.org/rich"
       template="layout/template.xhtml">
      
      <ui:define name="body">
      
       <h:messages globalOnly="true" styleClass="message" />
       <h:panelGrid columns="2" width="100%">
       <rich:column style="width:75%; vertical-align:top;">
       <rich:panel style="height: 170px">
       <f:facet name="header">Welcome!</f:facet>
       <p style="text-align: center"><font size="2"><u><b>Welcome
       to MobeeSuite Control Panel</b></u></font></p>
       <p style="text-align: center"><font size="2"><h:outputLabel
       value="To proceed further, Control Panel requires you to login."
       rendered="#{!identity.loggedIn}">
       </h:outputLabel></font></p>
       </rich:panel>
      
       </rich:column>
       <rich:column style="width:25%;">
       <rich:panel style="height: 170px">
       <f:facet name="header">Login:</f:facet>
       <ui:include src="login.xhtml">
      
       </ui:include>
       </rich:panel>
       </rich:column>
      
       </h:panelGrid>
       </ui:define>
      </ui:composition>




      template.xhtml

      <!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:s="http://jboss.com/products/seam/taglib">
      <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       <title>mobees</title>
       <link href="stylesheet/theme.css" rel="stylesheet" type="text/css" />
       <link rel="shortcut bar icon"
       href="http://www.manamtech.com/favicon.ico" />
      </head>
      
      <body>
       <ui:include src="header.xhtml">
      
       </ui:include>
       <div style="height:15px">
       </div>
       <ui:include src="menu.xhtml">
       <ui:param name="projectName" value="MobeeSuite"/>
       </ui:include>
      
       <div class="body">
       <ui:insert name="body"/>
       </div>
      
       <div class="footer">
       <ui:include src="footer.xhtml">
       </ui:include>
      
       </div>
      
      </body>
      </html>


      header.xhtml


      <ui:composition 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:s="http://jboss.com/products/seam/taglib"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
       <h:panelGrid columns="2" width="100%" cellspacing="0" cellpadding="0">
       <h:graphicImage style="float:left" value="/img/logo.gif" />
       </h:panelGrid>
      
      </ui:composition>



      Web.xml

      <?xml version="1.0" ?>
      <web-app 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-app_2_5.xsd"
       version="2.5">
      
       <!-- Ajax4jsf -->
      
       <context-param>
       <param-name>org.richfaces.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
      
       <!-- Seam -->
      
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <filter>
       <filter-name>Seam Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <servlet>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <url-pattern>/seam/resource/*</url-pattern>
       </servlet-mapping>
      
       <!-- Facelets development mode (disable in production) -->
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <!-- JSF -->
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <security-constraint>
       <display-name>Restrict raw XHTML Documents</display-name>
       <web-resource-collection>
       <web-resource-name>XHTML</web-resource-name>
       <url-pattern>*.xhtml</url-pattern>
       </web-resource-collection>
       <auth-constraint/>
       </security-constraint>
      
      
      
      </web-app>



      Here is what I see in the logs, when I just hit the url.
      03:22:29,125 INFO [STDOUT] INFO [http-127.0.0.1-8080-1] (Contexts.java:303) - starting up: org.jboss.seam.security.identity
      03:22:29,562 INFO [STDOUT] INFO [http-127.0.0.1-8080-1] (RuleBase.java:47) - parsing rules: /security.drl
      03:22:29,812 INFO [STDOUT] INFO [http-127.0.0.1-8080-1] (Contexts.java:303) - starting up: org.jboss.seam.web.session
      03:22:30,171 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jboss-seam-mail.jar!/META-INF/seam-mail.taglib.xml
      03:22:30,171 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jboss-seam-pdf.jar!/META-INF/seam-pdf.taglib.xml
      03:22:30,187 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
      03:22:30,218 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
      03:22:30,218 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
      03:22:30,234 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
      03:22:30,250 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
      03:22:30,250 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
      03:22:30,265 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/a4j.taglib.xml
      03:22:30,265 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/ajax4jsf.taglib.xml
      03:22:30,265 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/jsp.taglib.xml
      03:22:30,312 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/rich.taglib.xml
      03:22:30,328 ERROR [STDERR] Sep 25, 2008 3:22:30 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss-4.2.2.GA/server/default/deploy/mobees.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/richfaces.taglib.xml



      The above logs are rather common for all the projects.


      I am using richfaces 3.2.2 and seam 2.0.2

      This problem only appears from time to time, but it does appear everyday.


      Any help would be appreciated!

      Thanks


        • 1. Re: RichFaces generating blank css, Please Help!
          gjeudy

          Hi,

          I am also having the same issue with Seam 2.0.1.GA and Richfaces 3.2.1.GA. I noticed the issue on our staging server that has been up for a long time. The CSS returned is consistently blank for the past 2 days. I will update whether the problem goes away when the server is restarted. I bet it will.

          More specifically the problem can be displayed by using the CSS link directly in the browser, it returns an empty HTML body.

          /ReferenceDataManager/a4j_3_2_1-SNAPSHOTorg/richfaces/skin-ext-classes.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__

          Here are the richfaces specific config in my web.xml:

          <context-param>
           <param-name>org.richfaces.SKIN</param-name>
           <param-value>blueSky</param-value>
           </context-param>
          
           <context-param>
           <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
           <param-value>NEKO</param-value>
           </context-param>
          
           <!-- load all richfaces javascript upfront -->
           <context-param>
           <param-name>org.richfaces.LoadScriptStrategy</param-name>
           <param-value>ALL</param-value>
           </context-param>
           <context-param>
           <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
           <param-value>false</param-value>
           </context-param>
           <!-- load all richfaces css upfront -->
           <context-param>
           <param-name>org.richfaces.LoadStyleStrategy</param-name>
           <param-value>ALL</param-value>
           </context-param>
          
           <context-param>
           <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
           <param-value>com.sun.facelets.FaceletViewHandler</param-value>
           </context-param>
          


          Any ideas what could be wrong? I will have to embed the richfaces CSS content in the application CSS as a workaround. We really cannot gamble and always need the CSS for proper rendering.

          • 2. Re: RichFaces generating blank css, Please Help!
            nbelaevski

            Hello,

            Can you please check how CSS resources are loading using Firebug 'Net' tab or Fiddler tool? Are there any exceptions?

            • 3. Re: RichFaces generating blank css, Please Help!
              gjeudy

              Hi,

              Since the problem is intermittent I don't know how to reproduce. I cannot risk have it happening in staging or prod again therefore I copied all CSS contents generated by /a4j_3_2_1-SNAPSHOTorg/richfaces/skin-ext-classes.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__ link into my own CSS to ensure it is always loaded.

              Making directly the HTTP request for /a4j_3_2_1-SNAPSHOTorg/richfaces/skin-ext-classes.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__ returned empty content (it normally returns css styles), no exceptions to be seen on the server logs. This is as much as I can tell you.



              • 4. Re: RichFaces generating blank css, Please Help!
                cometta

                we also faced similar problem. anyone found solution on this?