1 2 Previous Next 19 Replies Latest reply on Jun 6, 2013 6:08 AM by rhanus Go to original post
      • 15. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
        shawnfirth

        Radim,

        A working example EAR would be great.

        Thanks again for your time...

        • 16. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
          rhanus

          ok I'm really curious what's wrong...

          give me an email and I will send you a simple project with instructions

          • 17. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
            shawnfirth
            • 18. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
              shawnfirth

              Radim,

              I got my Interceptor to work…but for my bean only. Thanks again for the working EAR Interceptor example.

               

              The reason that I wasn’t seeing the Interceptor invoke was because I had it on a bean function that was called by the bean’s PostConstruct function. This means that nesting annotations doesn’t work. The Only time my Interceptor works on my bean is if I apply it to the whole class. If I only apply it to a function, even just the PostConstruct function, it doesn’t fire/get invoked (this may be indicative of PostConstruct…right now I don’t have any other beans calling my singleton, but once I do, I will retest this).

               

              The Interceptor is also applied to a set function in one of my JPA data classes, and that data class is loaded and the set function is called from the bean during PostConstruct. If I remove my Interceptor from the bean, so that there isn’t any Interceptor nesting, the Interceptor doesn’t fire/get invoked on the JPA data class’ set function. BTW, the JPA data class lives in a different package but in the same JAR with the Interceptor.

               

              Once I have a session bean that is really using one of my JPA data classes, I’ll try the Interceptor again on a JPA data class, however, I’m guessing it still won’t fire (we’re early in our development).

               

              Thanks again for your help.

              Shawn

              • 19. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                rhanus

                you are welcome

                The reason that I wasn’t seeing the Interceptor invoke was because I had it on a bean function that was called by the bean’s PostConstruct function. This means that nesting annotations doesn’t work.

                it's common misunderstanding, simply said, cdi interceptors are called only from managed referencies (@Inject to @AroundInvoke) or under lifecycle operatios (container to @PostConstruct and @PreDestroy)

                 

                The Interceptor is also applied to a set function in one of my JPA data classes, and that data class is loaded and the set function is called from the bean during PostConstruct.

                be carefull it's really not a good idea to let manage jpa entities as cdi beans, there are problems with cdi context management

                1 of 1 people found this helpful
                1 2 Previous Next