Announcement Announcement Module
Collapse
No announcement yet.
Please help with an aspectj error message Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Please help with an aspectj error message

    Hi,

    I'm new with aspectj and do not known what is wrong with this
    aspect. I'm using aspectj 1.6.5, jdk 1.5, springframework 2.5.6

    Code:
    package de.xxx.gr.yyy.common.aspects;
    
    import org.aspectj.lang.annotation.Aspect;
    import org.aspectj.lang.annotation.Pointcut;
    import org.aspectj.lang.annotation.Around;
    import org.aspectj.lang.ProceedingJoinPoint;
    import org.springframework.stereotype.Component;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import net.sf.ehcache.Cache;
    import net.sf.ehcache.Element;
    
    import java.io.Serializable;
    
    
    @Aspect
    @Component
    public class MethodCache {
      private static final Log logger = LogFactory.getLog(MethodCache.class);
      private Cache methodCacheHolder;
    
      @Pointcut("execution(@Cachable * *(..)) && @annotation(cachable);")
      public void cachedObject(Cachable cachable) {
    
      }
    
      @Around(value = "de.xxx.gr.yyy.common.aspects.MethodCache.cachedObject(cachable)", argNames = "thisJoinPoint,cachable")
      public Object makeCaching(ProceedingJoinPoint thisJoinPoint, Cachable cachable) throws Throwable {
        String methodName = thisJoinPoint.getSignature().getName();
        Object[] arguments = thisJoinPoint.getArgs();
    ....
    The error message is:

    Code:
    2009-08-27 16:21:19 [URLClassLoader@167d940] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
    2009-08-27 16:21:31 [URLClassLoader@167d940] error at <Unknown>::0 Invalid pointcut 'execution(@Cachable * *(..)) && @annotation(cachable);': org.aspectj.weaver.patterns.ParserException: unexpected pointcut element: ;@53:53 at position 53
    2009-08-27 16:21:31 [URLClassLoader@167d940] error at de/xxx/gr/yyy/common/aspects/MethodCache.java::0 can't find referenced pointcut cachedObject
    Thanks for a help.
    Torsten

  • #2
    Try to exclude 'thisJoinPoint' from 'argNames' pointcut section. Join point is mapped automatically by aspectj.

    Comment

    Working...
    X