3 Replies Latest reply on Jan 23, 2008 4:30 AM by Nicklas Karlsson

    Event with @Observer not being fired

    Terry Apprentice

      Seam 2.0.1CR1

      Method with @Observer("org.jboss.seam.security.loggedOut") is not being recognised as event to fire.
      I also tried org.jboss.seam.loggedOut and @Observer(Identity.EVENT_LOGGED_OUT) but same thing.

      Using debugger shows Seam's Identity.logout() attempts to raise event but there is no event to be raised as
      Event.raiseEvent() method shows List variable 'observers' being null.

      Any clues please?

      Seam Events.java
      
       public void raiseEvent(String type, Object... parameters)
       {
      ...
      List<Init.ObserverMethod> observers = Init.instance().getObserverMethods(type);
       List<Init.ObserverMethod> observers = Init.instance().getObserverMethods(type);
       if (observers!=null)
       {
      ...
      
       }
      }
      
      
      
      My Authenticator.java
      
      @Observer("org.jboss.seam.security.loggedOut")
      public void logout() {
       activityLog.logOrgUser(orgUserAuthenticated.getUser(), ActivityLogger.Code.LOGOUT, null);
      }
      
      More details on this post:
      http://jboss.com/index.html?module=bb&op=viewtopic&t=128184
      


        • 1. Re: Event with @Observer not being fired
          Nicklas Karlsson Master

          I think the @Observer("org.jboss.seam.loggedOut") is the correct version nowadays but you already said it didn't work. Is the method in a seam-managed class? Can you get any other observers to trigger in that class?

          • 2. Re: Event with @Observer not being fired
            Terry Apprentice

            it is now resolved. thank you very much for the help, and my apologies I was asking for problem that didnt' exist.

            the problem occurred, due to JBDev not updating classes; becase after updating seam some dependency jar was missing.

            though something useful that came out of this:

            Events like "org.jboss.seam.loggedOut" will be replaced with to "org.jboss.seam.security.loggedOut" from next major release. 2.0.0CR1 currently supports both types. Now you could also use events like
            @Observer(Identity.EVENT_LOGGED_OUT).

            • 3. Re: Event with @Observer not being fired
              Nicklas Karlsson Master

              Oops, I must have been reading the wrong version :-/ But It's a good thing that we get the constants now.

              Although I wouldn't mind that they would all be in the Events class. So that your could find everything observable in one place.