6 Replies Latest reply on Oct 31, 2011 4:03 AM by ripers

    Zip file closed message with renderkit

    Anuj Kumar Newbie

      Hello Everyone,

       

      I have started with RichFaces 3.3.3 and trying some of the components. I am trying to use the basic skin and my web.xml has the entry-

       

      <context-param>

          <param-name>org.ajax4jsf.SKIN</param-name>

          <param-value>blueSky</param-value>

        </context-param>

       

      I am getting this exception often on my Jetty server and due to this exception the components are getting rendered as vanila HTML. I looked around for this exception but couldn't get it to work. Please take a look at this exception-

       

      2011-02-23 13:03:22.949:WARN::/Profile/*.jsf/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css

      /basic_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__

      java.lang.IllegalStateException: zip file closed

              at java.util.zip.ZipFile.ensureOpen(Unknown Source)

              at java.util.zip.ZipFile.access$100(Unknown Source)

              at java.util.zip.ZipFile$2.hasMoreElements(Unknown Source)

              at java.util.jar.JarFile$1.hasMoreElements(Unknown Source)

              at org.eclipse.jetty.util.resource.JarFileResource.exists(JarFileResource.java:161)

              at org.eclipse.jetty.webapp.WebAppContext.getResource(WebAppContext.java:371)

              at org.eclipse.jetty.webapp.WebAppContext$Context.getResource(WebAppContext.java:1190)

              at org.eclipse.jetty.servlet.DefaultServlet.getResource(DefaultServlet.java:342)

              at org.eclipse.jetty.server.ResourceCache.lookup(ResourceCache.java:186)

              at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:439)

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

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

              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534)

              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:475)

              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)

              at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:479)

              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)

              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:929)

              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:403)

              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184)

              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:864)

              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)

              at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection

      .java:247)

              at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)

              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)

              at org.eclipse.jetty.server.Server.handle(Server.java:352)

              at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596)

              at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java

      :1051)

              at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:590)

              at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)

              at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)

              at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:508)

              at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)

              at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)

              at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)

              at java.lang.Thread.run(Unknown Source)

       

      What might be the problem?

       

      Thanks for the help.

        • 1. Zip file closed message with renderkit
          Anuj Kumar Newbie

          Ok, Never mind. The issue was with the filter configuration, where I had the same filter for faces/* as well for the URL parameter.

           

          Thanks.

          • 2. Re: Zip file closed message with renderkit
            ripers Newbie

            Anuj Kumar wrote:

             

            Ok, Never mind. The issue was with the filter configuration, where I had the same filter for faces/* as well for the URL parameter.

             

            Thanks.

             

            In our application we have a very similar problem. We are running JSF2 with RichFaces 3.3.3.Final on Jetty 7.2.2. We can't upgrade to RichFaces 4 yet, so we are running with the following context parameter in our web.xml for compatibility

             

            {code}

            <context-param>

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

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

            </context-param>

            {code}

             

            We get the following error on any web resources (css, images, javascripts) at random intervals.

             

            {code}

            WARN  org.eclipse.jetty.util.log - /css/stylesheet.css

            java.lang.IllegalStateException: zip file closed

                at java.util.zip.ZipFile.ensureOpen(ZipFile.java:403) ~[na:1.6.0_22]

                at java.util.zip.ZipFile.access$100(ZipFile.java:29) ~[na:1.6.0_22]

                at java.util.zip.ZipFile$2.hasMoreElements(ZipFile.java:303) ~[na:1.6.0_22]

                at java.util.jar.JarFile$1.hasMoreElements(JarFile.java:222) ~[na:1.6.0_22]

            {code}

             

            In most cases a page-refresh is enough to remedy the problem, but this is not a good solution.

             

            Could you please elaborate what your excact problem was (configuration), and how you fixed it? Thanks.

            • 3. Re: Zip file closed message with renderkit
              Anuj Kumar Newbie

              Hi, Sorry for my bad update. It's been a long time and I myself don't remember what was the fix. But I managed to pull out this web.xml that worked for me-

               

                <context-param>

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

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

                </context-param>

                <context-param>

                  <param-name>javax.faces.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>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>false</param-value>

                </context-param>

                <context-param>

                  <param-name>org.ajax4jsf.SKIN</param-name>

                  <param-value>blueSky</param-value>

                </context-param>

                <context-param>

                  <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>

                  <param-value>com.sun.facelets.FaceletViewHandler</param-value>

                </context-param>

                <context-param>

                  <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>

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

                </context-param>

                <context-param>

                  <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>

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

                </context-param>

                <context-param>

                  <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>

                  <param-value>NEKO, TIDY</param-value>

                </context-param>

                <context-param>

                  <param-name>org.richfaces.CONTROL_SKINNING</param-name>

                  <param-value>enable</param-value>

                </context-param>

                <context-param>

                  <param-name>org.richfaces.LoadStyleStrategy</param-name>

                  <param-value>ALL</param-value>

                </context-param>

                <context-param>

                  <param-name>org.richfaces.LoadScriptStrategy</param-name>

                  <param-value>ALL</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.handleViewExpiredOnClient</param-name>

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

                </context-param>

                <filter>

                  <display-name>RichFaces Filter</display-name>

                  <filter-name>richfaces</filter-name>

                  <filter-class>org.ajax4jsf.Filter</filter-class>

                        <!-- Used for file upload -->

                        <init-param>

                    <param-name>createTempFiles</param-name>

                    <param-value>false</param-value>

                        </init-param>

                        <!-- Used for file upload -->

                        <init-param>

                      <param-name>maxRequestSize</param-name>

                      <param-value>2000000</param-value>

                        </init-param>

                </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>

                <listener>

                  <listener-class>com.sun.faces.config.ConfigureListener</listener-class>

                </listener>

                <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>*.jsf</url-pattern>

                </servlet-mapping>

                <login-config>

                  <auth-method>BASIC</auth-method>

                </login-config>

                <context-param>

                  <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>

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

                  <param-value>client</param-value>

                </context-param>

                <context-param>

                  <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>

                  <param-value>resources.application</param-value>

                </context-param>

               

              Also, my index.jsp redirects to welcome.xhtml file using simple jsp forward-

              <jsp:forward page="/welcome.jsf" />

               

              This worked for me, Please compare with yours and let me know if it does not work. I can look for more info.

               

              - Anuj

              • 4. Re: Zip file closed message with renderkit
                ripers Newbie

                Hi and thank you for your reply. We solved our problem by pulling our jsf-impl and jsf-api jars out of the war file. It seems to be a Jetty 7 specific problem. Anyways, I will take a look at your web.xml and see in what way it differs from ours.

                Thanks a lot for your reply!

                • 5. Re: Zip file closed message with renderkit
                  burton 999 Newbie

                  Hi ripers.

                  I am using Jetty embedded and JSF2.

                  I also have very similar problem.

                  Please tell me the details of the solution.

                   

                  Thank you.

                  • 6. Re: Zip file closed message with renderkit
                    ripers Newbie

                    Hi burton 999, as I said our solution was to put our jsf-impl and jsf-api dependency jar files outside of the web application .war-file. If you need any more help I will ask our architech to give you the specifics.