1 2 Previous Next 23 Replies Latest reply on Mar 6, 2009 6:27 PM by Vanessa Williams

    Observer methods being called multiple times

    Vanessa Williams Newbie

      I'm having a problem in which two methods @observe the same event. This should be ok, I guess--there is nothing in the documentation to preclude it and it seems to be a normal way to use an observer pattern.


      However, the result is that one of the two methods is being called twice.


      To get specific, since I don't know what's causing this, the first method is in an application-scoped component. Two developers are working on this project and I didn't write this one, but it looks something like this:



      @Name("registrationBookkeeper")
      @Scope(ScopeType.APPLICATION)
      public class RegistrationBookKeeper {
          @Logger private Log log;
          private int cnt = 0;
           
          @Observer("userRegistered")
          synchronized public void record(User user) {
              cnt++;
              log.info("User registered: username: " + user.getUserName());
              log.info(cnt + " users have registered since the last restart");
          }
      }
      



      The second is in a conversation-scoped component and looks something like this:



           @Observer("userRegistered")
           public void setDefaultProfileImage(User user) {
                
                Image profileImage = imageHome.getInstance();
                profileImage.setType(Image.ImageType.PROFILE);
                profileImage.setFileName("/img/default-user.png");
                profileImage.setFormat("image/png");
                profileImage.setWidth(50);
                profileImage.setHeight(50);     
                profileImage.setUser(user);
                imageHome.persist();
                user.setProfileImage(profileImage);
                update();
             }



      The event is raised when a User object is persisted, i.e. in UserHome.persist():



          @Override
          public String persist() {
                
           User user = getInstance();
      
              // do some stuff
              // ...
      
              String outcome = super.persist();
              if (outcome == "persisted") {
               if (Events.exists()) {
                      Events.instance().raiseEvent("userRegistered", user);
               }
              }
      
              return outcome;
          }
      



      Looks fine, right? But the second @Observer method (setDefaultProfileImage) is called twice for a single raising of the event userRegistered. I'm not sure if it's causing grief or not, but certainly the potential for it is there and I would prefer this did not happen.


      Is this behaviour expected? Can it be explained? Can it be avoided?


      Thanks in advance for any replies.


      Cheers,


      Vanessa

        • 1. Re: Observer methods being called multiple times
          Norman Richards Expert

          This should work as you expect.  Take a look at the debug log to see if perhaps you are generating the event twice or if something else is calling that method.



          • 2. Re: Observer methods being called multiple times
            Vanessa Williams Newbie

            Thanks for the response, Norman. At least I know what the expected behaviour is.


            I have checked (and double checked) that the event isn't being raised more than once and that no one else is calling the method.


            I can't find a single reason for it. :-( It's just like a gremlin in my app somewhere. Very disconcerting.


            I will make one more check that someone isn't calling a parent function multiple times, though that would be a problem all its own. If I find something I'll report back.


            In the meantime if anyone has ever seen a similar problem I'd love to hear about it.


            Cheers,


            Vanessa

            • 3. Re: Observer methods being called multiple times
              Nicklas Karlsson Master

              A long shot but: are you running hot deployment/debug mode? Is it possible you have another class somewhere (WEB-INF/dev or other forgotten place, not directly visible in IDE) that also is @Observe:ing the same thing?

              • 4. Re: Observer methods being called multiple times
                Vanessa Williams Newbie

                This was worth a shot, Nicklas, as I'd tried everything else (tracing through the code didn't help--way too many layers of indirection to make any sense whatsoever of--all I could tell was that the event was being raised once and the observer was being executed twice.)


                BTW, the second Observer method was a red herring. I commented it out and the double-execution problem remains.


                Unfortunately, by turning hotdeploy (debug) off, I ran into some other (unrelated) showstopping bug that didn't allow me to test your hypothesis. I couldn't figure out this second bug at all and so couldn't get anywhere testing the first!


                Lordy, but I'm really frustrated at this point.


                I need the Event/@Observer pattern to work as advertised, because a lot of my design is based on it and it's too late to redesign everything now.


                I appreciate all the responses I've received so far and if anyone else has any long shots to suggest, I'll be very glad to hear them.


                Cheers,


                Vanessa


                P.S. I guess in the meantime I'm off to scour the bug database for any conceivable clues.


                • 5. Re: Observer methods being called multiple times
                  Tim Evers Master

                  I think that because of the way debug/hot deployment works you should really focus on getting  your app working with this debug mode turned OFF.


                  There is a possibility that this could actually be your problem.


                  If your app stops working when debug mode is turned off that would indicate a larger underlying problem with your deployment or application code.

                  • 6. Re: Observer methods being called multiple times
                    Vanessa Williams Newbie

                    Ok, point taken Tim. I'll have to start a separate thread about the problem I'm seeing when debug is off, since it's as impenetrable to me as the Observer being called multiple times!


                    (Frustration setting in as I now have a stack of 3 incomprehensible bugs to solve!)


                    I guess I'll have to come back to this one.


                    Thanks, everyone, for your help so far.


                    Cheers,


                    Vanessa

                    • 8. Re: Observer methods being called multiple times
                      Damian Harvey Apprentice

                      It does sound like what Nicklas said. Check out https://jira.jboss.org/jira/browse/JBSEAM-2281


                      What version of Seam are you running? Fixed in 2.0.1.CR1.


                      Cheers,


                      Damian.

                      • 9. Re: Observer methods being called multiple times
                        Vanessa Williams Newbie

                        Although it took a long time to get my project deployed with all class files in /classes instead of some of them in /dev (I could not convince JBDS to deploy the project normally and had to do it by hand), it did not solve the problem. It's still being called twice. Also, I'm using 2.1.0SP1 so the bug you mention should have been fixed. (One more data point: it always fires twice. Not three times or four, etc., depending on number of hot deploys.)


                        I'm checking Thread.dumps and trying to get TRACE output as per Nicklas' last suggestion (not sure that's working... looks like I've only got DEBUG.)


                        Anyway, it was worth checking out. Thanks for the suggestion. At least I know one thing I did not know before: hot deploy is not the problem.


                        Cheers,


                        Vanessa

                        • 10. Re: Observer methods being called multiple times
                          Vanessa Williams Newbie

                          I don't think I've succeeded in getting the log level to TRACE yet, but I did add Thread.dumpStack() to the beginning of the Observer method to see what the call stack was for each invocation and what differences there might be. I'm including both stack dumps and then the difference between them. Maybe there's a clue in here somewhere:


                          First invocation stack dump:



                          ERROR [STDERR] java.lang.Exception: Stack trace
                          ERROR [STDERR]      at java.lang.Thread.dumpStack(Thread.java:1224)
                          ERROR [STDERR]      at com.yourview.session.UserHome.setDefaultProfileImage(UserHome.java:151)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          line 9: ERROR [STDERR]      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
                          ERROR [STDERR]      at org.jboss.seam.Component.callComponentMethod(Component.java:2215)
                          ERROR [STDERR]      at org.jboss.seam.core.Events.raiseEvent(Events.java:85)
                          ERROR [STDERR]      at com.yourview.session.UserHome.persist(UserHome.java:141)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                          ERROR [STDERR]      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:95)
                          ERROR [STDERR]      at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:89)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                          ERROR [STDERR]      at com.yourview.session.CurrentUserHome_$$_javassist_12.persist(CurrentUserHome_$$_javassist_12.java)
                          ERROR [STDERR]      at com.yourview.action.RegisterAction.register(RegisterAction.java:83)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                          ERROR [STDERR]      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                          ERROR [STDERR]      at com.yourview.action.RegisterAction_$$_javassist_18.register(RegisterAction_$$_javassist_18.java)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
                          ERROR [STDERR]      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
                          ERROR [STDERR]      at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                          ERROR [STDERR]      at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                          ERROR [STDERR]      at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                          ERROR [STDERR]      at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                          ERROR [STDERR]      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                          ERROR [STDERR]      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                          ERROR [STDERR]      at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
                          ERROR [STDERR]      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                          ERROR [STDERR]      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                          ERROR [STDERR]      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                          ERROR [STDERR]      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                          ERROR [STDERR]      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:86)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
                          ERROR [STDERR]      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          ERROR [STDERR]      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                          ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                          ERROR [STDERR]      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                          ERROR [STDERR]      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                          ERROR [STDERR]      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                          ERROR [STDERR]      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                          ERROR [STDERR]      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                          ERROR [STDERR]      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                          ERROR [STDERR]      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                          ERROR [STDERR]      at java.lang.Thread.run(Thread.java:637)
                          



                          Second invocation stack dump:



                          ERROR [STDERR] java.lang.Exception: Stack trace
                          ERROR [STDERR]      at java.lang.Thread.dumpStack(Thread.java:1224)
                          ERROR [STDERR]      at com.yourview.session.UserHome.setDefaultProfileImage(UserHome.java:151)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                          ERROR [STDERR]      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:95)
                          ERROR [STDERR]      at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:89)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                          ERROR [STDERR]      at com.yourview.session.UserHome_$$_javassist_15.setDefaultProfileImage(UserHome_$$_javassist_15.java)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
                          ERROR [STDERR]      at org.jboss.seam.Component.callComponentMethod(Component.java:2215)
                          ERROR [STDERR]      at org.jboss.seam.core.Events.raiseEvent(Events.java:85)
                          ERROR [STDERR]      at com.yourview.session.UserHome.persist(UserHome.java:141)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                          ERROR [STDERR]      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:95)
                          ERROR [STDERR]      at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:89)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                          ERROR [STDERR]      at com.yourview.session.CurrentUserHome_$$_javassist_12.persist(CurrentUserHome_$$_javassist_12.java)
                          ERROR [STDERR]      at com.yourview.action.RegisterAction.register(RegisterAction.java:83)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                          ERROR [STDERR]      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                          ERROR [STDERR]      at com.yourview.action.RegisterAction_$$_javassist_18.register(RegisterAction_$$_javassist_18.java)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
                          ERROR [STDERR]      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
                          ERROR [STDERR]      at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                          ERROR [STDERR]      at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                          ERROR [STDERR]      at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                          ERROR [STDERR]      at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                          ERROR [STDERR]      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                          ERROR [STDERR]      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                          ERROR [STDERR]      at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
                          ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
                          ERROR [STDERR]      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                          ERROR [STDERR]      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                          ERROR [STDERR]      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                          ERROR [STDERR]      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                          ERROR [STDERR]      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:86)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
                          ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
                          ERROR [STDERR]      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                          ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          ERROR [STDERR]      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                          ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                          ERROR [STDERR]      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                          ERROR [STDERR]      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                          ERROR [STDERR]      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                          ERROR [STDERR]      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                          ERROR [STDERR]      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                          ERROR [STDERR]      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                          ERROR [STDERR]      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                          ERROR [STDERR]      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                          ERROR [STDERR]      at java.lang.Thread.run(Thread.java:637)
                          



                          The difference between them: the second dump has extra lines before line 9 (which I marked as such in the first dump, above):



                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                          ERROR [STDERR]      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:95)
                          ERROR [STDERR]      at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
                          ERROR [STDERR]      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:89)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                          ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          ERROR [STDERR]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                          ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                          ERROR [STDERR]      at com.yourview.session.UserHome_$$_javassist_15.setDefaultProfileImage(UserHome_$$_javassist_15.java)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
                          ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          



                          I'll have to see if I can decode anything from this, but in the meantime any insights are welcome.


                          Thanks again,


                          Vanessa

                          • 11. Re: Observer methods being called multiple times
                            Vanessa Williams Newbie

                            Replying to myself... all of this came up because I was trying to fix a failure that happens right after this. Perhaps that failure is causing some kind of rollback? And perhaps that rollback calls my Observer again?


                            The former certainly sounds possible; the latter seems a bit weird, but... there is no doubt much I don't understand about how transactions are handled.

                            • 12. Re: Observer methods being called multiple times
                              Norman Richards Expert

                              I was unable to reproduce the issue in a simple test case.  If you can reproduce the problem in a clean (minimal) project or as a patch to an existing example, I'll take a look.

                              • 13. Re: Observer methods being called multiple times
                                Vanessa Williams Newbie

                                I managed to get the method to stop executing twice by moving it into a different component from the one that raised the event.


                                Somehow I'm sure there's something more to it than just that, but... it will have to do for now.


                                Thanks again for all the suggestions.


                                Vanessa

                                • 14. Re: Observer methods being called multiple times
                                  Vanessa Williams Newbie

                                  Of course, now the problem has magically re-appeared and is wreaking havoc. I'm pretty much at the end of my rope here. In 8 days of solid work, I've made no progress whatsoever. No idea where I'm going to go from here... Find a way to bypass Seam's event/observer mechanism I guess? I don't appear to have any other choices,,, I can't consistently duplicate the problem to take advantage of Norman's offer to look into it. I've hit a wall (that apparently isn't even there!) Sorry for the rant, I'm just really frustrated and depressed at this point... I appreciate that people have tried to help, just sad that nothing has worked for me. I hope you all have a much better day than I'm having :-(

                                  1 2 Previous Next