Announcement Announcement Module
Collapse
No announcement yet.
How to use SimpleTraceInterceptor with third-party classes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:
    http://forums.oracle.com/forums/thre...00308&tstart=0

    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:

    Code:
        <aop:config>
            <aop:advisor advice-ref="simpleTraceInterceptor" pointcut="execution(* net.sf.jasperreports.engine..*.*(..))"/>
        </aop:config>
    
        <bean id="simpleTraceInterceptor" class="org.springframework.aop.interceptor.SimpleTraceInterceptor">
            <property name="useDynamicLogger" value="true"/>
        </bean>
    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.

    Comment


    • #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?

      Comment


      • #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.

        Comment


        • #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.

          Comment


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

            Comment

            Working...
            X