7 Replies Latest reply on Sep 5, 2013 8:51 AM by lfryc

    Showcase a4j:push => Richfaces is not defined

    edilmar

      Hi,

       

      I have a big webapp in Glassfish3.1.1 + JSF2 + CDI/Weld + Apache CODI (for conversation) + RichFaces4.3.3 + Hibernate4.2.2,

      running many RichFaces components fine.

       

      Now, I want to implement a simple exchange messages/warnings system for the users.

       

      I tried to copy the code from Showcase (http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=push&sample=pushCdi&skin=blueSky)

      into my webapp, after download Atmosphere1.0.15, to test this sample, because I need something like this (just more complex).

       

      The producer sends the message, the message appears in PushCdiBean, no exceptions... but the consumer arises this JS error:

      Hora: 06-08-2013 16:13:04

      Erro: ReferenceError: RichFaces is not defined

      Arquivo-fonte: http://192.168.200.202:8080/sitesat2/cons.jsf?windowId=0aa

      Linha: 6

       

      The source code in HTML generated is this:

       

      <form id="j_idt1" name="j_idt1" method="post" action="/sitesat2/cons.jsf?windowId=5b9" enctype="application/x-www-form-urlencoded">

          <input type="hidden" name="j_idt1" value="j_idt1"/>

       

          Teste...

          <span id="j_idt1:j_idt2">

              <script type="text/javascript">RichFaces.Push.setPushResourceUrl("/sitesat2/rfRes/org.richfaces.resource.PushResource.jsf");RichFaces.Push.setPushHandlerUrl("/sitesat2/__richfaces_push");new RichFaces.ui.Push("j_idt1:j_idt2",{"address":"pushCdi","ondataavailable":function(event){alert(event.rf.data)}} );</script>

          </span>

          <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="H4sIAAAAAAAAAJVUzWsTQRSfJI39pKYftogUFKTgwY1VCkoVG5OULOajdONHVVgnyTSZsNldZybJpodiL4p4EdSDUNFDj8WLf4F4EISKCiKIgnivV8GTbzZfTW0RFzJ5k8y893u/32/fxhby25yhoSKuYKUsqKHEMC8ksO3v/vLq9djNDz7knUN9hoVzczgrLKaiXlFghBcsI+fY52eRfAaqPbAG4OMTyF/UaW6qzNDI9bib1sBmXklliiQrZh68u/oswI8ZXoQcG857y7fQCvJB5Lfhae26Vxg6Lm87yhLOEq5krZJtmcQUyiX1MiXVBcsSR+eZZRMmahdJjaPGMwyZGRpsV46a5dL2P22B9hmYCzXXatw9p5qC5Akb/vF8/dfq3dNe5FGRv4KNMoF8gfa5ZLmUIezOxuOJ/kff7zcbkYCVvQCHm/GeiGXfPQL1YSEYzZQF4QBupK1KiDFci1MunNWPE0/e4Kc+Ca+L02XilvdVu+QKlyZ3B6EJLEgMRCNMwxXCFt++PPdwbTPhRd446s0CITyJS0SgYVe0oGw1qAEYMz8TR30c7uTcHAKN1U9QK6gRRrFBl3HGIDOObVdkG4jLdQRonoXyCi+bLTDAsNOAEq5v9FhI01PJqJ5a0BOphageWUyGEmpYD8fUeKSRyf3qh/48DrA8/X8szzNagXq7kD3aJjtdwCLEiEaEW2tIOtNl1NuA4HY21NjI9SC0K1Cws0Ns2wbNYkEtU6mASZVwXI0m02pE09MpPRSJtPztaUVdMvA2XpuTcnPILTAJWv4r/U5Rw/f4Vzq1/m2HqDLdaIeI8pcD8k24YbE85MXZAlFKtXoZkIWYHIoAvTmqFPmSQku2ofAssCpVhEq8juIKNXNWtaGlmqtDaekAM2C8MQOopXSY5cX73g3t85b69xzYLdrXORtksL8lVNP6bW3GWw480UngTr7abksl5sGFyfQujpPhoEADjJhwj7B0zYaXILDdhWnoXh6b2MM9cj2yLT7ldI6eC5ZlEGxuHma3P639/gmj51pz9NjINQP04pvOnHFznPU4fwCs3YHBuAUAAA==" autocomplete="off"/>

      </form>

       

      What's the problem? I tested the online version of the Showcase and it worked fine.

        • 1. Re: Showcase a4j:push => Richfaces is not defined
          liuliu

          hi,

           

          it is better to show your xhtml code. but i think(guess) you should put at least one rich:something in your page.

           

          liu

          • 2. Re: Showcase a4j:push => Richfaces is not defined
            edilmar

            I tried exactly the same Producer and Consumer files from Showcase.

            Then, I tried to simplify the Consumer, deleting the h:panelGrid.

            I think there is some configuration needed for Atmosphere + RichFaces that I didn't,

            because Showcase works fine in my browser, and the downloaded files don't.

            • 3. Re: Showcase a4j:push => Richfaces is not defined
              michpetrov

              RichFaces is not defined means that the Javascript sources are not included properly. Are there any JS files linked in the <head> of your page?

              • 4. Re: Showcase a4j:push => Richfaces is not defined
                edilmar

                I just downloaded the original files from Showcase to my computer and run it into my webapp.

                This error is really stranged because I use many components from RichFaces just fine.

                The only component that doesn't work is a4j:push.

                • 5. Re: Showcase a4j:push => Richfaces is not defined
                  lfryc

                  Hey Edilmar, could you please include the javascript stack trace?

                  Just to know who tries to call RichFaces when it's not defined.

                   

                  At which point the error is thrown? Is it during page loading, after click to h:commandButton, a4j:commandButton or what?

                  • 6. Re: Showcase a4j:push => Richfaces is not defined
                    edilmar

                    Hi,

                     

                    The original problem was solved.

                    Now the problem is with Atmosphere:

                     

                    [code]

                    SEVERE: 51 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Auto detecting atmosphere handlers /WEB-INF/classes/

                     

                    SEVERE: 98 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Auto detecting WebSocketHandler in /WEB-INF/classes/

                     

                    SEVERE: 130 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol

                     

                    SEVERE: 155 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Atmosphere is using async support: org.atmosphere.container.GlassFishWebSocketSupport running under container: GlassFish Server Open Source Edition 3.1.1 with WebSocket enabled.

                     

                    SEVERE: 198 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Installed Default AtmosphereInterceptor [Android Interceptor Support, SSE Interceptor Support, JSONP Interceptor Support, Atmosphere JavaScript Protocol, Browser disconnection detection]. Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults in your xml to disable them.

                     

                    SEVERE: 200 [http-thread-pool-8080(2)] WARN org.atmosphere.cpr.AtmosphereFramework - No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache

                     

                    SEVERE: 200 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Shared ExecutorService supported: true

                     

                    SEVERE: 201 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - HttpSession supported: false

                     

                    SEVERE: 201 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory

                     

                    SEVERE: 201 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor

                     

                    SEVERE: 201 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster

                     

                    SEVERE: 204 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Atmosphere Framework 1.0.15 started.

                     

                    SEVERE: 204 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework -

                        For Atmosphere Framework Commercial Support, visit

                        http://www.async-io.org/ or send an email to support@async-io.org

                     

                    SEVERE: 264 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.DefaultBroadcaster - /__richfaces_push support Out Of Order Broadcast: false

                     

                    SEVERE: 267 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereFramework - Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path: /__richfaces_push

                     

                    SEVERE: 268 [http-thread-pool-8080(2)] INFO org.atmosphere.handler.ReflectorServletProcessor - Installing Servlet null

                     

                    SEVERE: 269 [http-thread-pool-8080(2)] INFO org.atmosphere.handler.ReflectorServletProcessor - Installing Filter PushHandlerFilter

                     

                    SEVERE: 284 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.DefaultBroadcaster - DefaultBroadcastere9ad7b87-ea61-4f30-b65b-2fe31da33f17 support Out Of Order Broadcast: false

                     

                    SEVERE: 287 [http-thread-pool-8080(2)] ERROR org.atmosphere.cpr.AtmosphereFramework - AtmosphereFramework exception

                     

                    SEVERE: java.lang.IllegalStateException: Make sure you have enabled Comet or make sure the Thread invoking that method is the same as the Servlet.service() Thread.

                        at com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:288)

                        at com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:307)

                        at org.atmosphere.container.GrizzlyCometSupport.suspend(GrizzlyCometSupport.java:139)

                        at org.atmosphere.container.GrizzlyCometSupport.service(GrizzlyCometSupport.java:121)

                        at org.atmosphere.container.GlassFishWebSocketSupport.service(GlassFishWebSocketSupport.java:70)

                        at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1445)

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

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

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

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

                        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

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

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

                        at util.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:50)

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

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

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

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

                        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

                        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

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

                        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

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

                        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

                        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

                        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

                        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

                        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

                        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

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

                    [/code]

                    • 7. Re: Showcase a4j:push => Richfaces is not defined
                      lfryc

                      It seems like upstream (Atmosphere) issue. But might be just misconfiguration.