Results 1 to 6 of 6

Thread: How to use SimpleTraceInterceptor with third-party classes

  1. #1

    Question 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. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

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

  3. #3

    Post 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. #4
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

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

    Default

    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. #6
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •