8 Replies Latest reply on Jan 9, 2010 4:50 AM by Nikolay Elenkov

    Seam and clustering

    Matthew Hibberd Newbie

      I am using Amazons EC2 service to deploy a Seam application into a clustered JBoss environment. I am using JBoss 5.1.0 GA and Seam 2.1.0 GA. The number of nodes in the cluster auto scales with demand and this is creating a very confusing issue for me.


      I have a page, view.xhtml, that includes a link as follows:


      <s:button action="#{my.seam.component.MyComponent.doSomething}">



      I load this page into a browser and wait. Then I force a new server to join the cluster. Then, if when I click the button on the page, the request is directed to the new server in the cluster, I get the following error on that server:


      2010-01-07 19:19:14,403 WARN  [org.jboss.seam.core.Interpolator] (http-0.0.0.0-8080-5) exception interpolating string: Unable to read view /view.xhtml to execute action "#{my.seam.component.MyComponent.doSomething}"
      javax.el.PropertyNotFoundException: Property 'doSomething' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_4



      If I go back and refresh the page and click the button again, everything works, even on the new server.


      Has anyone any idea where I can look to try and start diagnosing the problem? Thanks!

        • 1. Re: Seam and clustering
          Matthew Hibberd Newbie

          I can also reproduce this with 1 server as follows:
          1. Load the page
          2. Restart JBoss
          3. Click the button


          This seems to me to point to something obvious (probably lacking in my knowledge), but I dont know what!

          • 2. Re: Seam and clustering
            Stuart Douglas Master

            can you post the component definition?

            • 3. Re: Seam and clustering
              Nikolay Elenkov Master

              I haven't used clustering with EC2 but the recommended approach is to use sticky sessions. That is, each request from the same client goes to the same node. Only if that node fails, the request goes to a different node. What is MyComponent? EJB?


              • 4. Re: Seam and clustering
                Matthew Hibberd Newbie

                The load balancers that EC2 provides don't support sticky sessions unfortunately, else I would have already done that.


                Yes, MyComponent is a stateful EJB.


                Another thing to note: If I load the page in question in 1 browser (say Firefox), restart JBoss, then load the page in another browser (say IE) and now try clicking the button in the original browser, it works!
                Seems to me to suggest something about the beans/components backing the page haven't been initialised fully without the server at least loading the page 1st before the button is clicked. Does this offer any clues?


                @Stuart: I shall post my component definition asap in the morning, its at work and I cant 100% remember it ;)

                • 5. Re: Seam and clustering
                  Walter White Novice

                  Matt,


                  I would just add that your component should implement the Serializable interface then.



                  Walter

                  • 6. Re: Seam and clustering
                    Matthew Hibberd Newbie

                    @Walter - MyComponent already implements Serializable.


                    Here is my component definition:


                    @Name("my.seam.component.MyComponent")
                    @Stateful
                    @Clustered
                    public class MyComponentBean implements MyComponent



                    @Local
                    public interface MyComponent extends Serializable

                    • 7. Re: Seam and clustering
                      Matthew Hibberd Newbie

                      So I upgraded to Seam 2.2.0 GA and the exception I get changed to the following:


                      10:42:50,564 ERROR [Exceptions] handled and logged exception
                      java.lang.IllegalStateException: Unable to read view /view.xhtml to execute action "#{my.seam.component.MyComponent.doSomething}"
                           at org.jboss.seam.navigation.SafeActions.isActionSafe(SafeActions.java:67)
                           at org.jboss.seam.navigation.Pages.callAction(Pages.java:688)
                           at org.jboss.seam.navigation.Pages.preRender(Pages.java:330)
                           at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
                           at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
                           at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
                           at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
                           at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
                           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
                           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
                           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
                           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
                           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
                           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                           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:235)
                           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                           at org.jboss.web.tomcat.service.session.ClusteredSessionValve.handleRequest(ClusteredSessionValve.java:135)
                           at org.jboss.web.tomcat.service.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:94)
                           at org.jboss.web.tomcat.service.session.LockingValve.invoke(LockingValve.java:62)
                           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                           at java.lang.Thread.run(Thread.java:619)

                      • 8. Re: Seam and clustering
                        Nikolay Elenkov Master

                        Matthew Hibberd wrote on Jan 08, 2010 18:46:


                        So I upgraded to Seam 2.2.0 GA and the exception I get changed to the following:

                        10:42:50,564 ERROR [Exceptions] handled and logged exception
                        java.lang.IllegalStateException: Unable to read view /view.xhtml to execute action 
                        ...
                        




                        Is this the full stack trace? And before you go any further, are you sure session replication and SFSB state replication work correctly? Both use UDP by default, maybe EC2 is blocking it?