7 Replies Latest reply on Nov 28, 2013 11:41 PM by mlemus

    could I bind interceptors via pointcut in JBoss 7.x like in older versions?

    henrikdeluxe

      Hi,

      currently im migrating my Application from AS 5.1 to AS 7.2.0 (in general several maven projects containing many local and remote SLSB, some MDB, some Singleton-Beans --> standard EJB Stuff deployed in an ear)

       

      After managing some EJB3 --> EJB 3.1 issues now i wanted to migrate my interceptors.

      I have several interceptors but lets have a look at my logging interceptor. This interceptor should log method entry and exit of every public method in remote ejb's.

       

      In AS 5.1 i realized that by insert some pointcuts in the ejb3-interceptors-aop.xml file.

         <domain name="Stateless Bean" extends="Intercepted Bean" inheritBindings="true">
            <!-- some standard ejb stuff -->
      
            <bind pointcut="execution(public * @javax.ejb.Remote->*(..)) AND execution(public * de.mycompany.myapp.mymodule.server.*->*(..))">
              <stack-ref name="MyEJBInterceptors"/>
            </bind>
      
           <!-- some standard ejb stuff -->    
      
         </domain>
      
      

       

       

       

      Now i'm searching for a solution to do the same configuration on AS 7.2

       

      At the momement i have no idea and hope someone could help me please.

      Additionaly i have to say that for me is not a good way to annotate all RemoteBeans wiith @Interceptor

      There must be a way to bind the interceptor generally without the danger to forget one bean and have to recompile the whole ear.

       

      may someone has an advice?

      thank you

        • 1. Re: could I bind interceptors via pointcut in JBoss 7.x like in older versions?
          jaikiran

          AOP (interceptors) isn't supported in AS7. However, container interceptors are supported Container interceptors - JBoss AS 7.2 - Project Documentation Editor

          • 2. Re: could I bind interceptors via pointcut in JBoss 7.x like in older versions?
            henrikdeluxe

            Hi jaikiran,

             

            thank you for your fast response!

            For me it would be a mad step backwards if i have to bind my interceptor laborious separatly each for itself.

            So what would be the supposed solution for migrating old AOP features? Disable without any substitution?

             

            Is it possible to use the wildcard <ejb-name>*</ejb-name> together with an Postfix?

             

            For example i have 3 EJBs:

            myModule.jar

               - org.abc.Ejb1Remote

               - org.def.Ejb2Local

               - org.def.xyz.Ejb3Remote

             

             

            Would it work if i bind my Interceptor like this:

            <ci:container-interceptors>

                        <jee:interceptor-binding>

                            <ejb-name>*Remote</ejb-name>

                            <interceptor-class>org.my.interceptor.MyContainerinterceptor</interceptor-class>

                        </jee:interceptor-binding>

            </ci:container-interceptors>

            • 3. Re: could I bind interceptors via pointcut in JBoss 7.x like in older versions?
              jaikiran

              Henrik Hoffmann wrote:

               

              Hi jaikiran,

               

              thank you for your fast response!

              For me it would be a mad step backwards if i have to bind my interceptor laborious separatly each for itself.

              So what would be the supposed solution for migrating old AOP features? Disable without any substitution?

               

              Is it possible to use the wildcard <ejb-name>*</ejb-name> together with an Postfix?

               

              For example i have 3 EJBs:

              myModule.jar

                 - org.abc.Ejb1Remote

                 - org.def.Ejb2Local

                 - org.def.xyz.Ejb3Remote

               

               

              Those look like bean interfaces and not bean names. You can either user a wildcard * or the specific ejb-name but you can't use <ejb-name>*Foo</ejb-name>

              1 of 1 people found this helpful
              • 4. Re: could I bind interceptors via pointcut in JBoss 7.x like in older versions?
                henrikdeluxe

                Hi jaikiran,

                 

                thats really annoying to hear that there is no suitable way to do things like in older versions.

                My question is solved therfore.

                 

                For discussion:

                Does anyone knows the reasons for drop out these AOP features? Will they be redevelopped in further versions of JBoss?

                • 5. Re: could I bind interceptors via pointcut in JBoss 7.x like in older versions?
                  jaikiran

                  Henrik Hoffmann wrote:

                   


                   

                  For discussion:

                  Does anyone knows the reasons for drop out these AOP features? Will they be redevelopped in further versions of JBoss?

                  Here's the previous discussion about it Re: AOP in jboss AS 7.

                   

                  I think, AOP in the context of EJB containers (and perhaps AOP in general), has lived its life and I don't see it being redeveloped or supported in future versions of WildFly.

                  1 of 1 people found this helpful
                  • 6. Re: could I bind interceptors via pointcut in JBoss 7.x like in older versions?
                    mlemus

                    Hello Jaikiran, sorry for my bad english.

                    I'm migrating from Jboss 4 to Jboss 7.1.1 and I have a aspects.xml file with many aspects define, they look like this:

                     

                    <bean id="handler" class="com.main.Handler"></bean>

                    <aop:config>

                         <aop:aspect id="idaspect" ref="handler">

                              <aop:around pointcut="execution(* com.pack.sample.FirstTest.helloWorld(..))" method="printHandler" />

                         </aop:aspect>

                    </aop:config>

                     

                    I undertand that this code don't function any more in Jboss 7.

                    The question is, how can do this in Jboss 7?

                     

                    Thanks in advance.

                     

                    Miguel

                    • 7. Re: could I bind interceptors via pointcut in JBoss 7.x like in older versions?
                      mlemus

                      Hello again. One last question, if I wan't generate an Interceptor for all classes inside a package, let's said for example: com.ave.ppp.HelloWorld.java, com.ave.ppp.Goodbye.java. Both classes are in same package, com.ave.ppp.

                      Somehow there for declare <ejb-name>com.ave.ppp.*</ejb-name>? Or this is impossible in JBoss AS7?

                       

                      Thanks in advance.

                       

                      Miguel