[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] FW: NoSuchMethodError: aspectOf()
|
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Fri, 30 Oct 2009 15:31:48 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=btkY9uY3OuYPy3tv9MVVTre6DDsfvbhppu+PgHKbX4E=; b=mA1MepT0TAeQjwzDvAbL27FAQGSDz75DulwGAJxWNxGrGmDbMkRR9EyjcMDBEz7v10 Ejbt2gVwg9dAvsDX7EG4DkxhGiPYogCSoZHkDkRTe/Q+jX8coUL53fyIYemuJ28AckBw kJ4ryYW1jJQVLDSTWOo9rFdvd9SWSllgixfYQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Fe7luWmZlrF6RHS/HBDqRIouxNFQ0kL0+BaPa2NpY6q7OkXL4+nKvq4RmEl0Xog1q9 gl4Z6vKNfn+ATlhw2T0KdfOhNvm6Atr6YneHZy1pcY/9EzVXMDSsWnf5Hwo+1zdd29El /dTfhWk3u4zhLAJrSGtdLoBX1kXhXP2mIMAnA=
Hi Roger,
Are you definetly including the aspect itself in the call to iajc?
Annotation style aspects (when @Pointcut/etc are used) can be compiled
with javac, but they must be given to the weaver at some point in
order for the missing methods to be added - for example 'aspectOf()'.
cheers,
Andy
2009/10/30 Roger Huang <rhuang@xxxxxxxxxxxxxxx>:
> Any ideas why I am get the NoSuchMethodError below?
>
>
>
> The method specified by the pointcut is in
> com.foo.action.LoginAction.execute.
>
> The aspect is defined in com.foo.logging.Login. (see below)
>
> My code which is being advised does not call the aspect’s aspectOf() method.
>
>
>
> I use build-time bytecode weaving using the ant <iajc> task.
>
>
>
> The app is a Struts-based web app.
>
>
>
>
>
> Dev environment:
>
> Java 1.5
>
> Ant 1.7.1
>
> AspectJ 1.6.6
>
>
>
> Thanks,
>
> Roger
>
>
>
>
>
> javax.servlet.ServletException: Servlet execution threw an exception
>
> com.hyperformix.athens.filter.AthensLoginFilter.doFilter(Unknown
> Source)
>
> root cause
>
> java.lang.NoSuchMethodError:
> com.foo.logging.Login.aspectOf()Lcom/foo/logging/Login;
>
> com.foo.action.LoginAction.execute(Unknown Source)
>
>
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
>
>
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
>
>
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
>
>
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
>
> javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> com.foo.athens.filter.AthensLoginFilter.doFilter(Unknown Source)
>
>
>
>
>
>
>
>
>
> @Aspect
>
> public class Login {
>
>
>
> static Logger log = Logger.getLogger(Login.class.getName());
>
> String userName;
>
> String roleName;
>
>
>
> @Pointcut("call (* com.foo.LoginDAO.login(com.foo. Data) )
> && args(data)")
>
> public void login(Data data) {}
>
>
>
> @Before("login(data)")
>
> public void loginBefore(Data data)
>
> {
>
> userName = data.getUserName();
>
> roleName = data.getRoleName();
>
> BasicConfigurator.configure();
>
> log.info("User " + userName + " with role "
> + roleName + " about to login");
>
> }
>
>
>
> }
>
> Roger Huang
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>