title: java.lang.NoSuchMethodException: com.sun.proxy..... on struts2 actions
body: <p>I'm using spring AOP for the logging. The app works fine if I uncomment these lines</p>
  
  <pre><code>@Before("bean(*Action)")
  public void logActionEnter(JoinPoint jp) {
      log.info("Entering action: " + jp.getSignature().getName());
  }
  </code></pre>
  
  <p>I'm just wondering. This should work, but apparently it doesn't.</p>
  
  <pre><code>java.lang.NoSuchMethodException: com.sun.proxy.$Proxy630.login()
      java.lang.Class.getMethod(Class.java:1655)
      org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)
      org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
      org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
      org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      java.lang.Thread.run(Thread.java:724)
  </code></pre>
  
  <p>In case you're interesterd, the <code>login()</code> method</p>
  
  <pre><code>public String login() throws Exception {
      String name = getAuthService().loginUser(username, password);
  
      if(name == null) {
          setType("not_found");
          return "failed";
      }
      if(name.equals("LOCKED")) {
          setType("is_locked");
          return "failed";
      }
      if(name.equals("LOCKED_LOG")) {
          setType("login_lock");
          return "failed";
      }
  
      if(name.isEmpty()) {
          setType("auth_failed");
          return "failed";
      }
  
      if(session.containsKey("user")) return "session-active";
  
      User user = getAuthService().setUserActiveNow(username);
  
      session.put("user", username);
      session.put("completeName",name);
      session.put("access", getAuthService().getFunctionAccess(username));
      session.put("loginDate", user.getLastLoginDt());
      session.put("userId", user.getId());
  
      getAuditLogService().writeLog(username, new Date(), 
              ServletActionContext.getRequest().getRequestURL().toString(), username + ":" + name + " logged in to IVRBO");
  
      return "success-login";
  }
  </code></pre>
  
  <p><strong>EDIT</strong>: I have also a <code>validate()</code> method on this class.</p>
  
  <p><strong>EDIT</strong>: here's the XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xsi:schemaLocation="http://www.springframework.org/schema/beans 
                             http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                             http://www.springframework.org/schema/context
                             http://www.springframework.org/schema/context/spring-context-3.1.xsd
                             http://www.springframework.org/schema/aop
                             http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"&gt;
  
      &lt;!-- beans here --&gt;
  
      &lt;aop:aspectj-autoproxy proxy-target-class="true" /&gt;
  
      &lt;context:component-scan base-package="com.bdo.ivr" /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>The aspects. I used annotations.</p>
  
  <pre><code>import org.apache.log4j.Logger;
  import org.aspectj.lang.JoinPoint;
  import org.aspectj.lang.annotation.AfterThrowing;
  import org.aspectj.lang.annotation.Aspect;
  import org.aspectj.lang.annotation.Before;
  import org.springframework.stereotype.Component;
  
  @Component
  @Aspect
  public class LoggingAspect {
  
      Logger log = Logger.getLogger(this.getClass());
  
      @Before("bean(*Action)")
      public void logActionEnter(JoinPoint jp) {
          log.info("Entering action: " + jp.getSignature().getClass() + ": " + jp.getSignature().getName());
      }
  
      @Before("bean(*Service)")
      public void logServiceEnter(JoinPoint jp) {
          log.info("Entering service: " + jp.getSignature().getClass() + ": " + jp.getSignature().getName());
      }
  
      @Before("bean(*Dao)")
      public void logDaoEnter(JoinPoint jp) {
          log.info("Entering DAO: " + jp.getSignature().getClass() + ": " + jp.getSignature().getName());
      }
  
      @AfterThrowing(pointcut = 
              "bean(*Service) || bean(*Dao)",
            throwing = "e")
      public void logException(Exception e) {
          log.error("Exception", e);
      } 
  
  }
  </code></pre>