2 Replies Latest reply on Nov 10, 2008 10:29 AM by Martin Backhaus

    RaiseEvent set injected members to null - Seam 2.1.0

    Martin Backhaus Newbie
      Hi,

      we updatet to Seam 2.1.0 GA (tried SP1 too).
      Now we have some trouble. If an event occurs, while - sorry, english isnt my favorit language. Lets try java ;)

      SessionScopedClassA :: public String elCalledMethod()
      {
        myInjectedVariable.doSomething();  // works fine
        otherInjectedVariable.setValueAndRaiseEvent(value);  // will thieving our data since Seam 2.1.0
        myInjectedVariable.getClass(); // NPE occurs, myInjectedVariable is null
      }

      @RaiseEvent(MY_EVENT)
      OtherInjectedVariableSessionScopedClass :: setValueAndRaiseEvent(... value)
      {
         ...
         return NOT_NULL;  // sessionScopedClassA.myInjectedVariable != null
      }

      @Observer(MY_EVENT)
      APageScopedClass :: onMyEvent()
      {
         myInjectedVariable.giveMeSomething();  // myInjectedVariable is the same class as myInjectedVariable in SessionScopeClassA
                                                // and will not be changed
         ...
      }

      I found a thread:
      http://seamframework.org/Community/InjectedInstancesGettingLostOnLogin
      which could be related to my problem.

      Yours sincerely
      Martin
        • 1. Re: RaiseEvent set injected members to null - Seam 2.1.0
          Carsten Hoehne Master

          We have the same problem. But it is not easy to reproduce. Given a table of data with a link in one column. This link calls the elCalledMethod.
          Sometimes it is functioning sometimes not.


          We are not able to reproduce this error in an easy way.


          Do some others have seen some similar errors (context variabels are nulled out)?


          Any suggestions for hunting down this kind of error?

          • 2. Re: RaiseEvent set injected members to null - Seam 2.1.0
            Martin Backhaus Newbie
            I spent some time with debugging and there was two things I wondered:

            APageScopedClass :: onMyEvent() use SessionScopedClassA too.
            All injectable variables are injected and disjected on every use (within APageScopedClass :: onMyEvent()).
            The last thing, which is done, is disjecting. This explains why, the initialy injected, variables of SessionScopedClassA are null when returning to SessionScopedClassA :: public String elCalledMethod().

            I had a look at org.jboss.seam.core.BijectionInterceptor.
            The methode aroundInvoke() inject variables, calls invocation.proceed(), disinject variables and have a member -> counter <-
            I thougt - the often repeated dis-/injection - there is something wrong - and printed out the current value of counter (awaited a value > 0, and because of the often repeated dis-/injection exactly one) before invocation.proceed();.
            But the counter becomes negative and now I know that i dont understand the code or there is a bug.

            Any suggestion in which direction to debug next?

            Yours sincerely
            Martin