title: AOP : java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut
body: <p>I am new to AOP. I got some problem like this.</p>
  
  <pre><code>package org.suman.Aspect;
  
  import org.aspectj.lang.annotation.Aspect;
  import org.aspectj.lang.annotation.Before;
  import org.aspectj.lang.annotation.Pointcut;
  
  @Aspect
  public class LoginAspect {
      //@Before("execution(public String getName())")
      //@Before("execution(public String org.suman.Model.Triangle.getName())")
      //@Before("execution(* get*())")
      //@Before("execution(* get*(..))")
      //@Before("execution(* org.suman.Model.*.get*())")
  
      //@Before("execution(* get*())&amp;&amp; within(org.suman.Model.Circle)")
      @Before("execution(* get*())&amp;&amp; allCircle()")
      //@Before("allGetters() &amp;&amp; allCircle()")
      public void LoginAdvice()
      {
          System.out.println("Advice run.. getMethod is called");
      }
  
      @Before("execution(* get*())")
      //@Before("allGetters()")
      public void SecondAdvice()
      {
          System.out.println("this is a second Advice");
      }
      @Pointcut("execution(* get*())")
      public void allGetters(){}
  
      //@Pointcut("execution (* * org.suman.Model.Circle.*(..))")
      @Pointcut("within(org.suman.Model.Circle)")
      public void allCircle(){}
  
  } 
  </code></pre>
  
  <p>when using pointcut, the method <code>allGetters()</code> to <code>LoginAdvice</code> method, if I use  <code>@Before("execution(* get*())")</code> then no error but if I use <code>@Before("allGetters()")</code> then gives error  </p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut allGetters </p>
  </blockquote>
  
  <p>if I use <code>@Before("execution(* get*())&amp;&amp; within(org.suman.Model.Circle)")</code> instead of method name it works.  </p>
  
  <p>My xml like this:</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:aop="http://www.springframework.org/schema/aop"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"&gt;
      &lt;!-- &lt;context:annotation-config /&gt; --&gt;
      &lt;aop:aspectj-autoproxy /&gt;
  
      &lt;bean name="triangle" class="org.suman.Model.Triangle"&gt;
          &lt;property name="name" value="Triangle Name"&gt;&lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean name="circle" class="org.suman.Model.Circle"&gt;
          &lt;property name="name" value="Circle name"&gt;&lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean name="shapeService" class="org.suman.Services.ShapeService"
          autowire="byName"&gt;&lt;/bean&gt;
      &lt;bean name="loginAspect" class="org.suman.Aspect.LoginAspect"&gt;&lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Please solve the problem with pointcut by which it takes method</p>