Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] LTW not "running" in my WebApp

Hi There,

I've been getting accustomed to AspectJ over the last few days and have
created numerous stand-alone applications where I have effectively used LTW.

For example:

public class TestClass {
	private int x;
	private int y;

	public TestClass(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public static void main(String[] args) {
		TestClass tc = new TestClass(1, 2);
		tc = new TestClass(1, 2);
		tc = new TestClass(1, 2);

	}

}

Aspect:
public aspect TestAspect {
	after() returning(TestClass tc): call(TestClass.new(..)) {
		tc.setY(1000);
		 System.out.println("JUST CREATED A TC!!!!!!!! " + tc.getY());
	} 
}

aop.xml:
<aspectj>
            <aspects>
              <aspect name="jon.sandbox.aspect.TestAspect"/>
            </aspects>
            
            <weaver options="-verbose">
            </weaver>
            
</aspectj>

When I run this from the command line it works great!  I run it like:
java -classpath "<the classpath>" -javaagent:aspectjweaver.jar



My problems start when I try to get this to work in a servlet running in
Tomcat 6.

I have basically created a servlet and in the doGet() method I'm
instantiating a TestClass.  I've added a -javaagent:aspectjweaver.jar to the
startup and the Weaver starts and registers my Aspect but when I actually
come to run the servlet no LTW occurs!?!?

What gives?  What am I missing or doing wrong??

Any help would be greatly appreciated!

--
View this message in context: http://aspectj.2085585.n4.nabble.com/LTW-not-running-in-my-WebApp-tp3612958p3612958.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top