I have a java application build upon Spring 3. This project has another jar as a dependency.
This dependency contains a @org.aspectj.lang.annotation.Aspect
Considering it works perfectly fine when the classes are packaged with the application and spring I can only think it would be a classloading issue.
If it works fine when your bundled in your app then then when AOP scans all the classes that it will have to monitor then it is referencing the right classloader with all the right jars. But now when you remove it and set it into a JAR it is scanning under the classloader with all of the other third party jars.
I am not 100% sure how it is mapped out but it could be something like this:
Bootstrap Classloader <- Third Party Classloader <- Application Class Loader (with all your classes)
\ \
aspectj.jar spring.jar
If its aspect.jar is scanning under only its classloader then it will not be able to see 'all your classes'. One way you can try confirming this is to get a heap dump of your app. Run it against Eclipse MAT, Check out Class Loader explorer and look for the aspect classes. If they do not reside under the same classloader as your application you would have to look at a way to have tomcat tell the third party libraries of the application classes.