springjettyaopaspects

Using Spring Aspects with Jetty


I have an application that uses Aspects with Spring 3.1. It runs perfectly with Tomcat 7. The advised methods get called as expected.

I want it to work with Jetty. I've previously used Aspects with Spring 2.0 and Jetty with no major problems apart from adding a JVM agent. However I've had no luck with Jetty 6.22 and my Spring 3.1 application. I start Jetty with the javaagent thus

-javaagent:./spring-instrument-3.1.3.RELEASE.jar

where the Spring Instrument jar is in my CWD.

There is a similar question on StackOverFlow but no-one was able to come up with a working answer.


Solution

  • First of all, I'd highly recommend to use jetty 9 instead of jetty 6. Jetty 6 is End of Lifetime since a while now and it's missing lots of features and bugfixes!

    Besides that, are you using the --exec option somewhere in your configs? That will start a second jvm and probably that second jvm is not started with the javaagent setting place. You could verify that with "ps -ef | grep jetty" on *nix systems.