4 Replies Latest reply on Oct 30, 2008 7:02 AM by kabirkhan

    How to set a breakpoint for weaved classes.

    par_yosa

      Hi all,

      Question about the breakpoints for weaved classes with aop compiler;

      I defined some rules with jboss aop for some classes in my project and these classes weaved successfully with jboss aopc after that I set a breakpoint to some lines of weaved class.But during eclipse debugging the call flow is not broken at breakpoint line that is on the weaved class.

      Call flow is changed according to my defined rules in my jboss-aop.xml file, but I must debug it with eclipse to find out my bugs.

      Is there any option in build.xml file for aopc task or is there anyway to success that?


      thanks for your answers.
      Murat.

        • 1. Re: How to set a breakpoint for weaved classes.
          smile24

          I am also interested in this topic. I compile my .class files with aopc and see that in jar file appear new classes which names looks like this Service$service_1879079915250818794.class. I'm trying to debug my application using remote java application debugging in eclipse but it is no possible. I'm unable to debug beacause breakpoints can not be set because of missing line number attributes. Could somebody write what should I do to be able to debug my aspectized application? I use JBossAOP 1.5.6.GA release and JBossAS 4.2.2.GA.

          • 2. Re: How to set a breakpoint for weaved classes.
            flavia.rainone

            It is true that there is code running you can't see the lines it came from. AFAIK, there is no solution for this as you don't have the sources of the code that JBoss AOP weaves in your classes.

            Still, when I need to debug some aspectized class, I just add the breakpoint to the parts that I have written and that I want to debug, and it works. Inclusively, it works when I need to debug an aspect, I just add the breakpoint to the aspect itself and Eclpise stops when the aspect execution starts.

            If you run into a point of the stack where Eclipse gets lost (i.e., where it doesn't show where is the line it is running), just proceed pressing F5 until you get to your aspects code or until you get back to your aspectized class. I'm writing a tutorial about this at our blog, by the way. The part II, that talks about this stuff, should come out really soon.

            • 3. Re: How to set a breakpoint for weaved classes.
              smile24

              Hello Flavia,

              Thanx for really quick answer.

              "Still, when I need to debug some aspectized class, I just add the
              breakpoint to the parts that I have written and that I want to debug, and it works. Inclusively, it works when I need to debug an aspect, I just add the breakpoint to the aspect itself and Eclipse stops when the aspect execution starts."

              Could you write if it is any difference for debugging when I compile code with aopc in ant task so all compiled classes are stored then in my jar file or if I let JBoss to compile aopclasses in deploy time and aopclasses are stored then in .....\tmp\aopdynclasses\ucl... ?

              "If you run into a point of the stack where Eclipse gets lost (i.e., where it doesn't show where is the line it is running), just proceed pressing F5 until you get to your aspects code or until you get back to your aspectized class. I'm writing a tutorial about this at our blog, by the way. The part II, that talks about this stuff, should come out really soon."

              I read first part and can't wait to read this part II. Wish you the best to finish soon :)



              • 4. Re: How to set a breakpoint for weaved classes.
                kabirkhan

                 

                "smile24" wrote:

                Could you write if it is any difference for debugging when I compile code with aopc in ant task so all compiled classes are stored then in my jar file or if I let JBoss to compile aopclasses in deploy time and aopclasses are stored then in .....\tmp\aopdynclasses\ucl... ?

                There is no difference.

                It might help to run some of the examples that come with the aop download using aopc, and then use jad to decompile the generated classes to get a feel for what jboss aop generates, so you have more of an idea what/when to step in when debugging