9 Replies Latest reply: Aug 22, 2012 8:06 AM by Lukáš Fryč RSS

    a4j:push with Seam 2.3Beta2 with Richfaces 4.2

    nt2005 Newbie

      Hey Community,

       

      I try to use a4j:push in Richfaces 4.2 with Seam 2.3 and it is not working. What I have:

       

      @Name(TestBeanInterface.NAME)
      @JndiName(value=TestBeanInterface.JNDI_NAME)
      @Scope(ScopeType.SESSION)
      public class TestBean implements Serializable, TestBeanInterface {
      
      private static final String CDI_PUSH_TOPIC = "pushCdi";
      
      private String userIdentifier;
      
      @Inject
      @Push(topic = CDI_PUSH_TOPIC, subtopic = "#{testBean.userIdentifier}")
      private javax.enterprise.event.Event<String> pushEvent;
      
      @Create
      @Override
      public void init() {
          System.out.println("hey");
      
          if (userIdentifier == null) {
              userIdentifier = UUID.randomUUID().toString().replace("-", "");
          }
      
          TopicsContext topicsContext = TopicsContext.lookup();
          topicsContext.getOrCreateTopic(new TopicKey(CDI_PUSH_TOPIC, userIdentifier));
      }
      
      @Override
      public void sendMessage() throws Exception {
          System.out.println("Send Message");
          pushEvent.fire("a test message");
      }
      
      
      @Override
      public String getUserIdentifier() {
          return userIdentifier;
      }
      
      @Override
      public void setUserIdentifier(String userIdentifier) {
          this.userIdentifier = userIdentifier;
      }
      }
      
      

       

      What i get is:

       

      22:23:28,191 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Atmosphere is using async support: org.atmosphere.container.BlockingIOCometSupport running under container: JBoss Web/7.0.13.Final
      22:23:28,193 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol 
      22:23:28,201 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Installed Default AtmosphereInterceptor [Android Interceptor Support, SSE Interceptor Support, JSONP Interceptor Support]. Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults in your xml to disable them.
      22:23:28,203 WARN  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the HeaderBroadcasterCache.
      22:23:28,204 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) HttpSession supported: false
      22:23:28,205 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
      22:23:28,205 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
      22:23:28,206 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster
      22:23:28,208 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Atmosphere Framework 1.0.0.beta5 started.
      22:23:28,212 INFO  [org.atmosphere.cpr.MeteorServlet] (MSC service thread 1-2) Installed Filter/Meteor org.richfaces.webapp.PushHandlerFilter mapped to /*
      22:23:28,234 INFO  [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-2) Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path: /*
      22:23:28,236 INFO  [org.atmosphere.handler.ReflectorServletProcessor] (MSC service thread 1-2) Installing Servlet null
      22:23:28,238 INFO  [org.atmosphere.handler.ReflectorServletProcessor] (MSC service thread 1-2) Installing Filter PushHandlerFilter
      .....
      22:23:38,101 INFO  [stdout] (http-localhost-127.0.0.1-8080-1) hey
      22:23:38,538 WARN  [org.jboss.seam.mock.MockViewHandler] (http-localhost-127.0.0.1-8080-1) You should catch the exception before Seam: java.lang.IllegalArgumentException: no file extension in servlet path: /__richfaces_push
          at org.jboss.seam.mock.MockViewHandler.getActionURL(MockViewHandler.java:49) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.jsf.SeamViewHandler.getActionURL(SeamViewHandler.java:75) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.faces.FacesManager.redirect(FacesManager.java:168) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.faces.Redirect.execute(Redirect.java:154) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.exception.DebugPageHandler.handle(DebugPageHandler.java:32) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.exception.Exceptions.handle(Exceptions.java:76) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:114) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) [jboss-seam.jar:2.3.0.Beta2]
          at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:2.3.0.Beta2]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.13.Final.jar:]
          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
          at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
      

       

      Installing servlet null sounds not so good. I use atmosphere 1.0.0Beta5 on jboss as7.1.

       

      I think the main problem is that i try to use inject in a seam bean but @In is also not working. Sry I feel hopelessly.. >.<

        • 1. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
          Marek Novotny Expert

          Please check your version of atmosphere  with the versions recommended in https://community.jboss.org/wiki/StartingWithRichFacesPushOnVariousServletContainers

          • 2. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
            Lukáš Fryč Master

            Your issue is likely caused by wrong version of Atmosphere.

             

            RichFaces 4.2 is using 0.8.4.

            RichFaces 4.3 is using 1.0.0.beta5. (stable version of 4.3 wasn't released yet, only 4.3.0.M1 is available)

             

             

            There were backward-incompatible changes between Atmosphere 0.8.4 and 1.x.

             

             

            You can find all those informations in documentation and on wiki:

             

            http://docs.jboss.org/richfaces/latest_4_X/Developer_Guide/en-US/html/chap-Developer_Guide-Getting_started_with_RichFaces.html#sect-Developer_Guide-Getting_started_with_RichFaces-Technical_Requirements-Project_libraries_and_dependencies

             

            https://community.jboss.org/wiki/StartingWithRichFacesPushOnVariousServletContainers

            • 3. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
              nt2005 Newbie

              Thank you for your answers.

               

              No I do not get an exception like above.

              But pushEvent.fire("a test message"); throws a NullPointerException.

               

              I think @Inject is not working for me right now. Any ideas?

              • 4. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
                Lukáš Fryč Master

                I can't see stack trace of this NPE. Could you paste it here?

                 

                A stack trace you posted really does not seem good.

                 

                22:23:38,538 WARN  [org.jboss.seam.mock.MockViewHandler] (http-localhost-127.0.0.1-8080-1) You should catch the exception before Seam: java.lang.IllegalArgumentException: no file extension in servlet path: /__richfaces_push

                 

                Servlet is null is okay in this case, since we are using wrapping servlet in 4.3.0.M1.

                Be sure to use Atmosphere 0.8.4 in case you use RichFaces 4.2.

                It will likely fix this issue and it can also lead into fixing NPE during injection.

                • 5. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
                  nt2005 Newbie

                  Here it is:

                   

                  12:14:07,764 INFO  [org.atmosphere.cpr.AtmosphereServlet] (MSC service thread 1-2) Using BroadcasterFactory class: org.atmosphere.cpr.DefaultBroadcasterFactory
                  12:14:07,787 INFO  [org.atmosphere.cpr.AtmosphereServlet] (MSC service thread 1-2) Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path: /*
                  12:14:07,794 INFO  [org.atmosphere.cpr.AtmosphereServlet] (MSC service thread 1-2) Atmosphere is using async support: org.atmosphere.container.BlockingIOCometSupport running under container: JBoss Web/7.0.13.Final
                  12:14:07,798 INFO  [org.atmosphere.handler.ReflectorServletProcessor] (MSC service thread 1-2) Installing Servlet null
                  12:14:07,801 INFO  [org.atmosphere.handler.ReflectorServletProcessor] (MSC service thread 1-2) Installing Filter PushHandlerFilter
                  12:14:07,802 INFO  [org.atmosphere.cpr.AtmosphereServlet] (MSC service thread 1-2) Using broadcaster class: org.atmosphere.cpr.DefaultBroadcaster
                  12:14:07,804 INFO  [org.atmosphere.cpr.AtmosphereServlet] (MSC service thread 1-2) Atmosphere Framework 0.8.4 started.
                  .....
                  12:14:20,961 INFO  [stdout] (http-localhost-127.0.0.1-8080-3) hey
                  12:14:25,605 INFO  [stdout] (http-localhost-127.0.0.1-8080-2) Send Message
                  12:14:25,609 WARNUNG [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-localhost-127.0.0.1-8080-2) #{testBean.sendMessage()}: java.lang.NullPointerException: javax.faces.FacesException: #{testBean.sendMessage()}: java.lang.NullPointerException
                      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
                      at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:]
                      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]
                      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
                      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:2.3.0.Beta2]
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.13.Final.jar:]
                      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
                      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
                      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
                      at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
                  Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
                      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:]
                      ... 38 more
                  Caused by: java.lang.NullPointerException
                      at de.tud.iwm.flumen.test.TestBean.sendMessage(TestBean.java:51) [Flumen-ejb.jar:]
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_24]
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.6.0_24]
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.6.0_24]
                      at java.lang.reflect.Method.invoke(Method.java:616) [rt.jar:1.6.0_24]
                      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:35) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [jboss-seam.jar:2.3.0.Beta2]
                      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) [jboss-seam.jar:2.3.0.Beta2]
                      at de.tud.iwm.flumen.test.TestBean_$$_javassist_seam_4.sendMessage(TestBean_$$_javassist_seam_4.java) [Flumen-ejb.jar:]
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_24]
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.6.0_24]
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.6.0_24]
                      at java.lang.reflect.Method.invoke(Method.java:616) [rt.jar:1.6.0_24]
                      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335) [jboss-el.jar:1.0_02.CR6]
                      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:280) [jboss-el.jar:1.0_02.CR6]
                      at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59) [jboss-el.jar:1.0_02.CR6]
                      at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65) [jboss-el.jar:1.0_02.CR6]
                      at org.jboss.el.parser.AstValue.invoke(AstValue.java:96) [jboss-el.jar:1.0_02.CR6]
                      at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jboss-el.jar:1.0_02.CR6]
                      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:]
                      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                      ... 39 more
                  

                   

                  I call the methode sendMessage() via Webpage:

                  <h:outputText id="uid" value="UUID: #{testBean.userIdentifier}"/>
                      <h:form>
                          <h:commandButton value="Don't click!" action="#{testBean.sendMessage()}" />
                       </h:form>
                      <a4j:push address="#{testBean.userIdentifier}@pushCdi"
                                     onerror="alert('error: ' + event.rf.data)"
                                     ondataavailable="alert('data: ' + event.rf.data)">
                          <a4j:ajax event="dataavailable"/>
                      </a4j:push>
                  
                  • 6. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
                    Marek Novotny Expert

                    Are you using javax.inject.Inject  from CDI with Seam 2.3? That is not supported. You need to use Seam2 or Seam3/CDI,

                    • 7. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
                      Lukáš Fryč Master

                      You may want to use TopicsContext class directly instead of @Push annotation.

                      • 8. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
                        nt2005 Newbie

                        Than I cannot use Inject. I have to use Seam 2.3.

                         

                        Okay and how do I use TopicsContext directly?

                         

                        I got:

                        package de.tud.iwm.flumen.test;
                        
                        import java.io.Serializable;
                        import java.util.UUID;
                        
                        import javax.enterprise.event.Event;
                        import javax.inject.Inject;
                        
                        import org.jboss.seam.ScopeType;
                        import org.jboss.seam.annotations.Create;
                        import org.jboss.seam.annotations.JndiName;
                        import org.jboss.seam.annotations.Name;
                        import org.jboss.seam.annotations.Scope;
                        import org.jboss.seam.annotations.intercept.PostConstruct;
                        import org.richfaces.application.push.TopicKey;
                        import org.richfaces.application.push.TopicsContext;
                        import org.richfaces.cdi.push.Push;
                        
                        @Name(TestBeanInterface.NAME)
                        @JndiName(value=TestBeanInterface.JNDI_NAME)
                        @Scope(ScopeType.SESSION)
                        public class TestBean implements Serializable, TestBeanInterface {
                             
                            private static final String CDI_PUSH_TOPIC = "pushCdi";
                             
                            private String userIdentifier;
                            
                            private transient TopicKey topicKey;
                            private transient TopicsContext topicsContext;
                             
                            @Create
                            @Override
                            public void init() {
                                System.out.println("hey");
                             
                                if (userIdentifier == null) {
                                    userIdentifier = UUID.randomUUID().toString().replace("-", "");
                                }
                                try {
                                    topicsContext = TopicsContext.lookup();
                                    topicKey = new TopicKey(CDI_PUSH_TOPIC, userIdentifier);
                                    topicsContext.getOrCreateTopic(topicKey);
                                } catch(Exception e) {
                                    e.printStackTrace();
                                }
                            }
                             
                            @Override
                            public void sendMessage() throws Exception {
                                System.out.println("Send Message");
                                topicsContext.publish(topicKey, "Hello World");
                            }
                             
                             
                            @Override
                            public String getUserIdentifier() {
                                return userIdentifier;
                            }
                             
                            @Override
                            public void setUserIdentifier(String userIdentifier) {
                                this.userIdentifier = userIdentifier;
                            }
                        }
                        

                         

                        But nothing happens, no error, no pushing.

                        • 9. Re: a4j:push with Seam 2.3Beta2 with Richfaces 4.2
                          Lukáš Fryč Master

                          The usage seems almost okay, just do not cache TopicsContext - you can obtain it from context each time you do sendMessage - that call is not expensive.

                           

                          If this won't work for you, I believe you will end up with debugging your app.

                           

                          You can see RichFaces Showcase, where this works fine:

                          http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=push&skin=blueSky

                           

                          You can try that with simple development example push-demo, where you can try reproduce your issue,

                          without using Seam 2.3 (which is not required dependency here):

                          https://github.com/richfaces/dev-examples/tree/develop/push-demo