3 Replies Latest reply on Sep 22, 2011 4:19 AM by mhn

    richfaces js files sometimes served with size 0

    mhn

      I use Richfaces 3.3.3 in combination with myFaces 1.2.X and facelets. The application is running fine on many locations for years except for one installation.

       

      Static resources are not loaded correctly on this installation which result in a not useable application.

      This problem occurs only in Internet Explorer (tested with version 6-8). It does also occur with Firefox.

       

      In this szenario users receive messages like "Message: 'ModalPanel' is undefined " or "'jQuery.hotkeys' is null or not an object".

      All users are affected. Mostly it happens immediately after the load of the first page, sometimes later on.

       

      We saw with a network sniffer that the content-length of the JavaScript file (e.g jquery.hotkeys.js) is 0 and HTTP status code 200.

      But this happens also for other richfaces js files (e.g.modalPanel.js).

       

      Request: (masked some values with xxx):

      GET /xxx/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/jquery.hotkeys.js HTTP/1.1

      Host: xxx

      Accept: */*

      Referer: https:/xxx/faces/facelets/mypage.xhtml

      Accept-Language: en-us

      User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; xxx)

      Accept-Encoding: gzip, deflate

      Cookie: xxx

      authmethod: xxx

      authmethods: xxx

      X-Forwarded-For: xxx

      X-Forwarded-Host: xxx

      X-Forwarded-Server: xxx

      Connection: Keep-Alive

       

      Response:

      HTTP/1.1 200 OK

      Server: Apache-Coyote/1.1

      Cache-Control: private,max-age=3600

      Pragma: private

      Expires: Sat, 27 Aug 2011 14:45:32 GMT

      Content-Length: 0

      Date: Fri, 26 Aug 2011 14:45:32 GMT

       

       

      The application is accessed through a reverse proxy with an authenticating Apache HTTPd configured with mod_proxy.

      Connection between client and proxy is https. Connection between proxy and Tomcat is http.

       

      We run with a default richfaces config.

       

      Did anybody else met this problem?

      Any ideas how to solve this without system access and without being able to reproduce it?

        • 1. Re: richfaces js files sometimes served with size 0
          mhn

          I corrected my initial bug report. This issue occurs also in Firefox.

           

          Now I got a new logfile with more detailed logging, which contains a NullPointerException in the PhaseListener!

           

          [2011-09-19 12:27:11,601] http-8080-16 [DEBUG] [] BaseFilter doFilter: Filter start request processing at 9/19/11 12:27 PM  for uri: /test_ax/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanel.js

          [2011-09-19 12:27:11,601] http-8080-16 [DEBUG] [] AjaxPhaseListener beforePhase: Process before phase RESTORE_VIEW(1)

          [2011-09-19 12:27:11,601] http-8080-16 [DEBUG] [] ResourceLifecycle invokePhaseListener: Exception in PhaseListener, phase :RESTORE_VIEW(1) : beforePhase

          java.lang.NullPointerException

          [2011-09-19 12:27:11,601] http-8080-16 [DEBUG] [] InternetResourceService serviceResource: Get content from cache for resource org/richfaces/renderkit/html/scripts/modalPanel.js

          [2011-09-19 12:27:11,601] http-8080-16 [DEBUG] [] BaseFilter doFilter: Finished request processing total time 0ms for uri: /test_ax/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanel.js

           

          Does this help?

          Why is a PhaseListener even called for a js file?

           

          The Faces Servlet is mapped to  <url-pattern>/faces/*</url-pattern>

          javax.faces.DEFAULT_SUFFIX is ".xhtml"

           

          Any help is highly appreciated here

          • 2. Re: richfaces js files sometimes served with size 0
            mhn

            Now I got a stacktrace from another js file (we changed the LoadStrategy)

             

            [2011-09-20 16:59:27,479] http-8080-1 [DEBUG] [] BaseFilter doFilter: Filter start request processing at 9/20/11 4:59 PM  for uri: /xxx/faces/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js

            [2011-09-20 16:59:27,479] http-8080-1 [DEBUG] [] AjaxPhaseListener beforePhase: Process before phase RESTORE_VIEW(1)

            [2011-09-20 16:59:27,479] http-8080-1 [DEBUG] [] ResourceLifecycle invokePhaseListener: Exception in PhaseListener, phase :RESTORE_VIEW(1) : beforePhase

            java.lang.NullPointerException

                at org.apache.catalina.connector.Request.setAttribute(Request.java:1469)

                at org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:503)

                at org.apache.myfaces.context.servlet.RequestMap.setAttribute(RequestMap.java:53)

                at org.apache.myfaces.util.AbstractAttributeMap.put(AbstractAttributeMap.java:105)

                at org.apache.myfaces.util.AbstractAttributeMap.put(AbstractAttributeMap.java:38)

                at org.apache.myfaces.webapp.filter.ServeResourcePhaseListener.beforePhase(ServeResourcePhaseListener.java:71)

                at org.ajax4jsf.resource.ResourceLifecycle.invokePhaseListener(ResourceLifecycle.java:202)

                at org.ajax4jsf.resource.ResourceLifecycle.processPhaseListeners(ResourceLifecycle.java:178)

                at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:117)

                at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:226)

                at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)

                at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:508)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:384)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at com.recommind.litigation.client.web.filters.LoginFilter.doFilter(LoginFilter.java:224)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at com.recommind.litigation.client.web.filters.CacheFilter.doFilter(CacheFilter.java:114)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

                at java.lang.Thread.run(Thread.java:662)

            [2011-09-20 16:59:27,479] http-8080-1 [DEBUG] [] BaseFilter doFilter: Finished request processing total time 15ms for uri: /xxx/faces/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js

             

            Could there be a problem with the FacesContext?

            • 3. Re: richfaces js files sometimes served with size 0
              mhn

              Issue could be solved.

               

              It was caused by a not released FacesContext which I created manually in a non faces request. This FacesContext was created in the http thread of the login request which was redirected to another page. The javascript error occurred when this http thread was reused in order to fetch a richfaces javascript. The deprecated FacesContext was reused in this thread and richfaces was therefore not able to serve the javascript resource.

               

              Unfortunately this error was logged with debug level only and mostly without any stacktrace and the js file was served without any content as a consequence of this.