Announcement Announcement Module
No announcement yet.
How to use SimpleTraceInterceptor with third-party classes Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use SimpleTraceInterceptor with third-party classes

    Hi everyone!

    I hope this is not a stupid question, but I'm quite tired at this hour, and can't think anymore...
    I have a problem with compiling JasperReports inside a web-application that is run in Weblogic.
    It's the same problem that this guy here noticed, but no solution was found:

    Now, that is not related to Spring AOP, but this is:

    I wanted to trace the calls made by the JasperReports compiler and I tried to add an advisor like this:

            <aop:advisor advice-ref="simpleTraceInterceptor" pointcut="execution(* net.sf.jasperreports.engine..*.*(..))"/>
        <bean id="simpleTraceInterceptor" class="org.springframework.aop.interceptor.SimpleTraceInterceptor">
            <property name="useDynamicLogger" value="true"/>
    Unfortunately the first problem that I found is that some of the methods that I wanted to trace are actually static methods (class methods), and static methods cannot be intercepted with Spring AOP...

    But moving on... there are still some non-static methods (instance methods) around there that I would like to trace.
    But they seem to not be intercepted in any way...
    Probably because they are not instantiated/managed by Spring.

    Is there any way to intercept such third-party methods with SimpleTraceInterceptor?

  • #2
    You can exploit aspectj weaving for including aspect logic to the non-spring-managed beans.


    • #3
      Thanks for your response

      Can you please show me a quick example of how to configure this in Spring?
      Because I have not used AspectJ weaving before...
      Do I need to use the AspectJ compiler?


      • #4
        You can check my previous posts on Spring AOP forum - I mentioned complete standalone examples of load-time aspect weaving.

        You can also keep track on my blog - I'm going to create small article that explains what aspectj weaving types are available and contains complete standalone examples of that.


        • #5
          Thank you.
          Actually I needed to trace some JasperReports methods because of the classloader issues that I mentioned above. The problems occured on a Weblogic server installed on a test machine, different than my development machine.
          But I found it easier to just install Weblogic on my development machine also, and then I used the debugger in IDEA.


          • #6
            It's ok then. There is even more easier way - you could just use remote debugging with the same result.