9 Replies Latest reply on Jul 26, 2006 1:21 PM by gavin.king

    @Logger - usage question

    jazir1979

      Hi there,

      I've been using the new @Logger annotation successfully to inject Log instances to a stateless session bean.

      However, I've just created a new stateless session bean with Application scope, a @Startup annotation and a @Create method, and the log instance is not being injected.

      Are there any limitations to the current implementation of @Logger?

      cheers,
      Daniel.

        • 1. Re: @Logger - usage question
          gavin.king

          stateless session beans do not support @Create and @Destroy methods.

          I probably need to document this.

          • 2. Re: @Logger - usage question
            jazir1979

            That's strange, because my @Create create() method is being called. The stateless session bean in question is being used as a scheduled task (has an @Timeout method), and I'm setting up the timer in the @Create method to fire every second. And it's working... just that the @Logger is not being injected.

            thanks for yr response though, I'll do it another way,
            Daniel.

            • 3. Re: @Logger - usage question
              jschuetter

              Hi,
              logger is not injected on a stateful bean either. Somehow I feel Seam annotations are not correctly processed for @Startup components.
              Would like to know as well if anyone has an idea why @Create works on stateless beans?

              Thanks a lot
              Jens

              [Btw, if anyone from Jboss listens, org.jboss.seam.remoting.wrapper.DateWrapper is not registered for remoting in 1.0.1GA --> dates cannot be passed from Javascript]

              • 4. Re: @Logger - usage question
                gavin.king

                OK, you guys are doing something very wrong here. A stateless session bean is supposed to be bound to the STATELESS scope. Hence it cannot have an @Startup annotation, since @Startup applies only to APPLICATION and SESSION scoped components.

                • 5. Re: @Logger - usage question
                  gavin.king

                   

                  Btw, if anyone from Jboss listens, org.jboss.seam.remoting.wrapper.DateWrapper is not registered for remoting in 1.0.1GA --> dates cannot be passed from Javascript



                  Please report this in JIRA.

                  • 6. Re: @Logger - usage question
                    gavin.king

                    Note also that @Startup components are instantiated outside of the context of JSF, so not all functionality is available from the @Create method.

                    • 7. Re: @Logger - usage question
                      jschuetter

                      Thanks for the quick answer.
                      I'll post the remoting bug on JIRA once I figured out where to find that.
                      Maybe it wasn't clear but I do use a stateful session bean not stateless.
                      @PersistenceContext is injected, @Logger is not.

                      Jens


                      @Startup
                      @Name("dbCache")
                      @Stateful
                      @Scope(ScopeType.APPLICATION)
                      @Interceptors(SeamInterceptor.class)
                      public class DBCacheBean implements DBCache {
                      
                       @Logger private Log log;
                      
                       @PersistenceContext
                       private EntityManager entityManager;
                      


                      • 8. Re: @Logger - usage question
                        gavin.king

                         

                        I'll post the remoting bug on JIRA once I figured out where to find that.


                        http://jira.jboss.com/jira/browse/JBSEAM



                        • 9. Re: @Logger - usage question
                          gavin.king

                          Note that yesterday I committed some changes to CVS so that injection works during the startup phase.

                          You guys were right, there was a bug there.