Announcement Announcement Module
No announcement yet.
Problem with AspectJ's LTW with Spring's instrument Java Agent Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with AspectJ's LTW with Spring's instrument Java Agent


    I'm unable to weave a method in an external dependency (Jetty HTTPClient) when using AspectJ's LTW with the Spring's Instrument Java Agent.

    I have the required:

    <context:load-time-weaver aspectj-weaving="on"/>
    in the application context xml file that declares the aspect bean (before component-scan).

    I have set the Aspect's bean factory-method as "aspectOf" and I have included the Jetty's package in the weaver:

    <include within="org.eclipse.jetty.client..*"/>
    and set the correspondent aspect class in AOP.xml.

    With this configuration AspectJ's LTW fails to weave the aspect. If I add the aspectj weaver as an additional Java Agent without changing anything else in my configuration, the weaving succeeds (but for some reason the LTW takes much longer to finish).

    Do you have any idea why this can be occurring? Is it possible to have Spring AOP and AspectJ LTW simultaneously in the same project? Is there any better documentation source for AspectJ's integration in Spring than the official Spring one?

    Thanks in advance.

  • #2
    HttpClient class was being loaded to the JVM before Spring-driven AspectJ LTW was started.