8 Replies Latest reply on Mar 7, 2012 5:14 PM by Jason Klassen

    Push in Richfaces 4.2 final with Firefox

    Jason Klassen Newbie

      I'm using JSF 2.0 with a4jPush from Richfaces 4.2 final and firefox and coming accross a bunch of these errors.  Predictably the page is not updating with the push event.  The code works fine in Chrome and IE9 which leads me to believe it's an atmosphere/firefox issue. 

       

      2012-02-29 16:48:51.462:WARN::EXCEPTION

      java.lang.IllegalStateException: Request object no longer valid. This object has been cancelled

      at org.atmosphere.cpr.AtmosphereResourceImpl.getRequest(AtmosphereResourceImpl.java:384)

      at org.atmosphere.cpr.AtmosphereResourceImpl.getRequest(AtmosphereResourceImpl.java:403)

      at org.atmosphere.container.Jetty7CometSupport.action(Jetty7CometSupport.java:178)

      at org.atmosphere.container.Jetty7CometSupport.action(Jetty7CometSupport.java:65)

      at org.atmosphere.cpr.AtmosphereResourceImpl.cancel(AtmosphereResourceImpl.java:673)

      at org.atmosphere.container.Jetty7CometSupport$1.onComplete(Jetty7CometSupport.java:103)

      at org.eclipse.jetty.server.AsyncContinuation.doComplete(AsyncContinuation.java:610)

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

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

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

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

      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)

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

       

      I'm setup with maven running jetty 8.0.0M3 RichFaces 4.2 with the following and can see that it downloads atmosphere 0.8.4

       

      <properties>

              <org.richfaces.bom.version>4.2.0.Final</org.richfaces.bom.version>

      </properties>

      ...

      <plugin>

      <groupId>org.mortbay.jetty</groupId>

      <artifactId>jetty-maven-plugin</artifactId>

      <version>8.0.0.M3</version>

      </plugin>

      ...

          <dependencyManagement>

       

         <dependency>

                      <groupId>org.richfaces</groupId>

                      <artifactId>richfaces-bom</artifactId>

                      <version>${org.richfaces.bom.version}</version>

                      <scope>import</scope>

                      <type>pom</type>

                  </dependency>

          </dependencyManagement>

      ...

      <dependencies>

      <dependency>

                  <groupId>org.richfaces.ui</groupId>

                  <artifactId>richfaces-components-ui</artifactId>

                  <exclusions>

                      <exclusion>

                          <artifactId>jsf-api</artifactId>

                          <groupId>com.sun.faces</groupId>

                      </exclusion>

                      <exclusion>

                          <artifactId>jsf-impl</artifactId>

                          <groupId>com.sun.faces</groupId>

                      </exclusion>

                  </exclusions>

              </dependency>

              <dependency>

                  <groupId>org.richfaces.core</groupId>

                  <artifactId>richfaces-core-impl</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.atmosphere</groupId>

                  <artifactId>atmosphere-runtime</artifactId>

              </dependency>

      </dependencies>

       

       

      In web.xml i have

       

          <context-param>

              <param-name>org.richfaces.push.jms.disable</param-name>

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

          </context-param>

          <context-param>

              <param-name>org.richfaces.push.initializeOnStartup</param-name>

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

          </context-param>

       

      Any Ideas?

        • 1. Re: Push in Richfaces 4.2 final with Firefox
          Brendan Healey Master

          You getting any js errors showing up in firebug - can you check this?

          • 2. Re: Push in Richfaces 4.2 final with Firefox
            Jason Klassen Newbie

            I'll look for js errors.  The error above is happening on the jetty server, as output to the console. 

             

            Of note is that I was able to get push working using richfaces 4.1 final, TopicsContextInitializer, and the same Jetty 8.0.0M3 in Firefox, Chrome, and IE9 working perfectly and without Jetty error. 

             

            Do you know if atmosphere 0.8.4 needs a specific version of Jetty 8?

            • 3. Re: Push in Richfaces 4.2 final with Firefox
              Brendan Healey Master

              Can you try specifically this version:

               

              <dependency>

                          <groupId>org.atmosphere</groupId>

                          <artifactId>atmosphere-runtime</artifactId>

                          <version>0.8.0-RC1</version>

                          <type>jar</type>

              </dependency>

               

              good idea... don't forget to clean & build.

              • 4. Re: Push in Richfaces 4.2 final with Firefox
                Jason Klassen Newbie

                using 0.8.0-RC1 breaks it as soon as I try a push. relevant bits from the jetty output trace look like

                 

                2012-03-01 09:22:04.756:WARN::/MyAppDirectory/__richfaces_push

                java.lang.RuntimeException: javax.servlet.ServletException: Throwable

                        at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:154)

                        at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:200)

                        at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:141)

                        at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:87)

                        at org.atmosphere.container.Servlet30CometSupportWithWebSocket.service(Servlet30CometSupportWithWebSocket.java:124)

                        at org.atmosphere.cpr.AtmosphereServlet.doCometSupport(AtmosphereServlet.java:1159)

                        at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:1140)

                        at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:1126)

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

                        at org.eclipse.jetty.websocket.WebSocketServlet.service(WebSocketServlet.java:65)

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

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

                        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1359)

                        at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)

                        at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)

                        at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)

                        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)

                        at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)

                        at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)

                        at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)

                 

                ...

                Caused by:

                javax.servlet.ServletException: Throwable

                        at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:147)

                        at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:116)

                        at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.service(ReflectorServletProcessor.java:293)

                        at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:151)

                        at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:200)

                 

                ...

                Caused by:

                java.lang.NoClassDefFoundError: org/atmosphere/websocket/WebSocket

                        at org.richfaces.application.push.impl.RequestImpl.isPolling(RequestImpl.java:73)

                        at org.richfaces.application.push.impl.RequestImpl.suspend(RequestImpl.java:64)

                        at org.richfaces.webapp.PushHandlerFilter.doFilter(PushHandlerFilter.java:107)

                        at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:139)

                        at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:116)

                ....

                Caused by:

                java.lang.ClassNotFoundException: org.atmosphere.websocket.WebSocket

                        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)

                        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)

                        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)

                        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:420)

                        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:373)

                        at org.richfaces.application.push.impl.RequestImpl.isPolling(RequestImpl.java:73)

                • 5. Re: Push in Richfaces 4.2 final with Firefox
                  Jason Klassen Newbie

                  using richfaces 4.2.0.CR1 and it's bom settings for atmosphere brings me back to the original jetty problem of

                   

                  2012-03-01 11:06:43.561:WARN::EXCEPTION
                  java.lang.IllegalStateException: Request object no longer valid. This object has been cancelled
                          at org.atmosphere.cpr.AtmosphereResourceImpl.getRequest(AtmosphereResourceImpl.java:384)
                          at org.atmosphere.cpr.AtmosphereResourceImpl.getRequest(AtmosphereResourceImpl.java:403)
                          at org.atmosphere.container.Jetty7CometSupport.action(Jetty7CometSupport.java:178)
                          at org.atmosphere.container.Jetty7CometSupport.action(Jetty7CometSupport.java:65)
                          at org.atmosphere.cpr.AtmosphereResourceImpl.cancel(AtmosphereResourceImpl.java:673)
                          at org.atmosphere.container.Jetty7CometSupport$1.onComplete(Jetty7CometSupport.java:103)
                          at org.eclipse.jetty.server.AsyncContinuation.doComplete(AsyncContinuation.java:610)
                          at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:649)
                          at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:393)
                          at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
                          at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
                          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
                          at java.lang.Thread.run(Thread.java:662)

                  • 6. Re: Push in Richfaces 4.2 final with Firefox
                    Jason Klassen Newbie

                    Update: Firefox works partially. 

                     

                    1. I load my app in firefox and go to the page that lazy loads a grid.  i can see the push attempted but no ajax screen update.

                    2. leave firefox browser open

                    3. I load the app in IE 9 and go to the page that lazy loads a grid. i can see the push attempted and *both* the firefox browser and IE browser do an ajax screen update.

                    3 a. Chrome can be substituted for IE with the same effect but 2 firefox browsers do not trigger each other

                     

                    Same behavior is seen using 4.2.0.Final or 4.2.0.CR1

                     

                     

                    • 7. Re: Push in Richfaces 4.2 final with Firefox
                      Jason Klassen Newbie

                      I've run jetty with mvn jetty:run -Dorg.eclipse.jetty.util.log.DEBUG=true  to get some extra output, what I see about every 40 seconds is

                       

                      ... previous call ...

                      2012-03-02 12:47:19.160:DBUG::return with suspended request

                       

                      2012-03-02 12:49:19.581:DBUG::async request [GET /MyApp/__richfaces_push?__richfacesPushAsync=1&pushSessionId=582c446b-b1c6-4884-988e-4c7510a78
                      66d&_=1330714129577]@2004958114 org.eclipse.jetty.server.Request@77813ba2
                      2012-03-02 12:49:19.582:WARN::EXCEPTION
                      java.lang.IllegalStateException: Request object no longer valid. This object has been cancelled
                              at org.atmosphere.cpr.AtmosphereResourceImpl.getRequest(AtmosphereResourceImpl.java:384)
                              at org.atmosphere.cpr.AtmosphereResourceImpl.getRequest(AtmosphereResourceImpl.java:403)
                              at org.atmosphere.container.Jetty7CometSupport.action(Jetty7CometSupport.java:178)
                              at org.atmosphere.container.Jetty7CometSupport.action(Jetty7CometSupport.java:65)
                              at org.atmosphere.cpr.AtmosphereResourceImpl.cancel(AtmosphereResourceImpl.java:673)
                              at org.atmosphere.container.Jetty7CometSupport$1.onComplete(Jetty7CometSupport.java:103)
                              at org.eclipse.jetty.server.AsyncContinuation.doComplete(AsyncContinuation.java:610)
                              at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:649)
                              at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:393)
                              at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
                              at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
                              at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
                              at java.lang.Thread.run(Thread.java:662)
                      2012-03-02 12:49:19.588:DBUG::closed org.eclipse.jetty.server.nio.SelectChannelConnector$SelectChannelHttpConnection@1cab7dc2@127.0.0.1:8080<->127.0.0
                      .1:15582
                      2012-03-02 12:49:19.590:DBUG::REQUEST /MyApp/__richfaces_push on org.eclipse.jetty.server.nio.SelectChannelConnector$SelectChannelHttpConnectio
                      n@7fe76be4@127.0.0.1:8080<->127.0.0.1:15588
                      2012-03-02 12:49:19.591:DBUG::scope null||/MyApp/__richfaces_push @ o.m.j.p.JettyWebAppContext{/MyApp,[file:...]},file:.../MyApp/src/main/webapp/
                      2012-03-02 12:49:19.596:DBUG::Got Session ID 1a9v6juql8vct1f2i6pyhr1bls from cookie
                      2012-03-02 12:49:19.597:DBUG::sessionManager=org.eclipse.jetty.server.session.HashSessionManager@29c60bd
                      2012-03-02 12:49:19.600:DBUG::session=org.eclipse.jetty.server.session.HashSessionManager$HashedSession:1a9v6juql8vct1f2i6pyhr1bls@1169476611
                      2012-03-02 12:49:19.600:DBUG::servlet /MyApp|/__richfaces_push|null -> AutoRegisteredPushServlet
                      2012-03-02 12:49:19.601:DBUG::chain= ShiroFilter->AutoRegisteredPushServlet
                      2012-03-02 12:49:19.601:DBUG::call filter ShiroFilter
                      2012-03-02 12:49:19.602:DBUG::call servlet AutoRegisteredPushServlet
                      2012-03-02 12:49:19.603:DBUG::RESPONSE /MyApp/__richfaces_push  200
                      2012-03-02 12:49:19.603:DBUG::return with suspended request

                       

                      2012-03-02 12:49:49.116:DBUG::async request [GET /MyApp/__richfaces_push?__richfacesPushAsync=1&pushSessionId=98289192-96af-4fa9-ac69-38d0dd8ce
                      2ba&_=1330714159111]@64430781 org.eclipse.jetty.server.Request@3d722bd
                      2012-03-02 12:49:49.116:WARN::EXCEPTION
                      java.lang.IllegalStateException: Request object no longer valid. This object has been cancelled
                              at org.atmosphere.cpr.AtmosphereResourceImpl.getRequest(AtmosphereResourceImpl.java:384)

                      ... repeat ...

                      • 8. Re: Push in Richfaces 4.2 final with Firefox
                        Jason Klassen Newbie

                        Closing the issue.

                         

                        I put a js alert onto the push and I can see Firefox, IE, Chrome all responding to push from server or any of the other 3 browser sessions.

                         

                        <a4j:push id="pushTest" address="Test_Topic"  ondataavailable="alert('here')"></a4j:push>

                         

                        I still see the atmosphere WARN:: EXCEPTION every 40 seconds on the jetty server but it does not appear to be impacting the push functionality, a bit of a red herring.  The server config is RichFaces 4.2.0.Final, Jetty 8.0.0M3, and atmosphere-runtime 0.8.4