Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] FW: NoSuchMethodError: aspectOf()

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
>
>


Back to the top