6 Replies Latest reply on Aug 22, 2007 3:05 PM by gavin.king

    Logger object nulled after passivation

    pdpantages

      Hello forum:

      Seam 1.2.1.GA,
      Jboss 4.0.5

      I have a problem with my Logger disappearing on me.

      This seems to happen if I don't touch its containing component ( a SFSB ) for > 5 mins. The bean is passivated. When it is re-activated, the logger is null.

      My scenario is this:

      I have a long running conversation continaing two components, say bean1, bean2.

      Both components are SFSB, Conversational, scope CONVERSATION.

      The operator can move between two pages, within the same long runnig conversation, to interact with one component or the other.

      I have an ajax poll that touches the page's backing bean when the operator is on the page.

      The poll keeps the page up to date and keeps the conversation from timing out if the operator doesn't touch it, as long as the browser or tab is not closed.

      Each page polls its own bean but not the other pages's bean.

      So, when the operator hangs around the second page for >5 minutes, bean1 is passivated.

      Thank when he returns to the fist page, bean1 is re-activated, and the first ajax poll throws an NPE when it tries to print a log message.

      This happens cases where I have a single conversation or use nested conversations for the two pages involved.

      I saw the commentary in
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=110879
      which says that injected objects are not passivated as they are cleared after invocation. Is hte @Logger Log treated differently? It is non-null before passivation (see below) but is cleared after.

      My logger is injected with the usual:

      @Logger
      private Log log;
      


      Some debug statements in bean1:
      @PrePassivate
      public void prePasivate()
      {
       System.out.println("PDP prePasivate()");
       System.out.println("PDP log is " + log );
      }
      
      @PostActivate
      public void postActive()
      {
       System.out.println("PDP postActive()");
       System.out.println("PDP log is " + log );
      }
      


      The output:

      PDP prePasivate()
      PDP log is org.jboss.seam.log.LogImpl@dbbc62
      PDP postActive()
      PDP log is null


      Any ideas would be appreciaed...

      Thanks, PdP