4 Replies Latest reply on Jul 28, 2010 8:45 AM by viveknandavanam

    Dynamic AOP application, not able to redeploy the aspects at runtime

    viveknandavanam

      Hello,

       

      I am very new to JBoss and AOP. I have been trying to implement dynamic aop and i am using jboss-4.2.3-GA and JDK 1.6.0_01.

      Jboss aop in use is the one that comes with 4.2.3 by default.

      An interceptor that i created is getting invoke from an sample application.

      From this interceptor i am calling a session bean which has a method to return a string.

      I have deployed the session bean along with the home and remote interface in one jar, and the interceptor in a plain jar.

      The extract from the *-aop.xml is as below:

       

      <aop>

       

         <prepare expr="all(com.other.anotherbean.*)"/>

       

         <typedef name="Transform" expr="class(com.other.test.Bean)"/>

       

           <bind pointcut="execution(* $typedef{Transform}->someMethod(..))">
              <interceptor class="com.test.interceptor.InterceptorClass"/>
          </bind>

       

      </aop>

       

      I am making a change in the session bean(in anotherbean package) and redeploying it so that it returns a different string without restarting jboss.

      But i see that the changes are not reflected.

      The 'EnableLoadtimeWeaving' attribute is set to true in jboss-service.xml and i have added -javaagent:pluggable-instrumentor.jar in run.bat file.

      The example ear and wars created using jboss aop1.5 seem to work fine.

       

      I see that the class that are prepared are being deployed in the server/<server-config>/tmp/aopdynclasses folder.

      And each time i make changes in the bean and redeploy it new folders are being created at runtime under folder named ucl*, and during each edit and redeployment a new folder is created with the aspectized classes(e.g: classname$methodname_N5164114663869737738.class) being put into the ucl* folders. These class id's are same for the different classes that are created in different ucl* folders.

       

      Why are the changes not reflecting in runtime?

      Please point me in the right direction.

       

      -Regards,

      Vivek

        • 1. Re: Dynamic AOP application, not able to redeploy the aspects at runtime
          flavia.rainone

          Hi!

           

          What do you mean with "the changes are not reflected"? How is the archive structure that is being redeployed? I need to know this in order to answer your question

           

          Anyway, I think it is a good idea to update the JBoss AOP version and see if the problem gets resolved. The JBoss AOP release comes with a script for installation on JBoss AS 4.

          • 2. Re: Dynamic AOP application, not able to redeploy the aspects at runtime
            viveknandavanam

            Hi Flavia,

             

            Thanks for your reply.

            I did upgrade to jboss-aop-2.0.0, but still not getting it.

             

            Sorry for using the term 'reflected'. What i meant to say was that i am not able to see the changes i made in the code after redeployment.

            The archive structure that is redeployed(JAR) is like this:

            /

            SessionBean

            HomeInterface

            RemoteInterface

            META-INF/

            MANIFEST.MF

            ejb-jar.xml

             

            I am compiling and creating the jars externally. Later redeploying it into the deploy folder at runtime.

             

            Thanks,

            Vivek

            • 3. Re: Dynamic AOP application, not able to redeploy the aspects at runtime
              flavia.rainone

              Vivek Nandavanam wrote:


              The archive structure that is redeployed(JAR) is like this:

              /

              SessionBean

              HomeInterface

              RemoteInterface

              META-INF/

              MANIFEST.MF

              ejb-jar.xml

               

              I am compiling and creating the jars externally. Later redeploying it into the deploy folder at runtime.


               

              I'm still missing some information... where is the aop stuff you deployed? And how is that packaged?

              What are the changes you applied to the code, and to which part of the code?

               

              Once I can see the whole picture, I hope I will be able to help you :-)

              • 4. Re: Dynamic AOP application, not able to redeploy the aspects at runtime
                viveknandavanam

                Thanks again for your replies.

                 

                I am deploying the session bean as a class that needs to be aspectized. And this session bean class i am including in the *-aop.xml.

                Can this be done?

                 

                I am making the changes in the methods in the Session bean.

                The methods have print statements. I am changing these print statements and redeploying the jar.

                These methods are deployed in the aopdynclasses folder as aspectised classes (even after redeployment).

                And these changes in the print statements are the changes that i want to see when the jar is redeployed.

                 

                The interceptor class is being deployed as a jar with the structure

                /

                Interceptor.class

                META-INF/

                MANIFEST.MF

                From this interceptor i am calling the session bean methods.

                 

                Regards,

                Vivek