title: AspectJ Aspect under JBoss AS 7 throws Xlint:invalidAbsoluteTypeName
body: <p>I have a set of WARs that worked without problems on JBoss 6.1.0.Final that use AspectJ 1.6.12 and Spring 3.1.2.RELEASE, built with Maven.  We would like to move to JBoss AS 7 in the near future, so I compiled JBoss 7.1.3.Final from source.</p>
  
  <p>I decided to repackage the application as an EAR file after I had problems with individual WAR files, and so all of our code would be in one, redistributable, deployable unit.</p>
  
  <p>I am having trouble getting our profiling aspect working.  It is an extremely simple aspect contained in a JAR in our EAR/lib directory, that times any method annotated with the @Timed annotation:</p>
  
  <pre><code>package com.mycompany.toplayer.perf;
  
  import org.aspectj.lang.ProceedingJoinPoint;
  import org.aspectj.lang.annotation.Around;
  import org.aspectj.lang.annotation.Aspect;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.stereotype.Component;
  
  
  @Component
  @Aspect
  public class MethodTimerAdvice {
      private Logger log = LoggerFactory.getLogger(getClass());
  
      @SuppressWarnings("unchecked")
      @Around(value="execution(@com.mycompany.toplayer.perf.Timed * *(..))")
      public Object timeMethod(ProceedingJoinPoint pjp) throws Throwable
      {
          String methodName = pjp.getSignature().toShortString();
          long start = System.currentTimeMillis();
  
          Object ret = pjp.proceed();
  
          long end = System.currentTimeMillis();
  
          long total = end - start;
  
          long used_mem = Runtime.getRuntime().totalMemory()
                  - Runtime.getRuntime().freeMemory();
          long mem_gb = used_mem / (1024 * 1024);     
  
          log.trace("{} | {} | {}M | {} | {} | {}", 
                  new Object[] {start, total, 
                          mem_gb, 
                          Thread.currentThread().getId(), 
                          Thread.currentThread().getName(),   
                          methodName}
          );
  
          return ret;
      }
  }
  </code></pre>
  
  <p>Note that the annotation is in the same package.<br>
  Here is the relevant Spring configuration file for the aspect, again it is very simple:</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/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
      &lt;context:component-scan base-package="com.mycompany" /&gt;
      &lt;aop:aspectj-autoproxy&gt;&lt;/aop:aspectj-autoproxy&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>There are three WAR files included in the EAR, but right now only one of them is using this aspect, gdm-updater.WAR.  When I attempt to start the server, I get errors like this:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: warning no match for this type name: Timed [Xlint:invalidAbsoluteTypeName]
      at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301) [aspectjtools.jar:]
      at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.aspectj.AspectJExpressionPointcut.getFallbackPointcutExpression(AspectJExpressionPointcut.java:358) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.aspectj.AspectJExpressionPointcut.getShadowMatch(AspectJExpressionPointcut.java:409) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:272) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:226) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:264) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:296) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1598) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      ... 28 more
  </code></pre>
  
  <p>I also tried including AspectJ as a module, and here is the jboss-deployment-structure.xml file included with the EAR.</p>
  
  <pre><code>&lt;jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0"&gt;
    &lt;deployment&gt;
      &lt;exclusions&gt;
        &lt;module name="org.hibernate" slot="main"/&gt;
      &lt;/exclusions&gt;
    &lt;/deployment&gt;
    &lt;sub-deployment name="gdm-updater-1.2.0-SNAPSHOT.war"&gt; 
        &lt;exclusions&gt;
            &lt;module name="org.hibernate" slot="main"/&gt;
          &lt;/exclusions&gt;
          &lt;dependencies&gt;
            &lt;module name="org.aspectj.tools" slot="main" /&gt;
            &lt;module name="org.aspectj.weaver" slot="main" /&gt;
          &lt;/dependencies&gt;
    &lt;/sub-deployment&gt;   
  &lt;/jboss-deployment-structure&gt;
  </code></pre>
  
  <p>I even tried using the Maven AspectJ compiler plugin in gdm-updater.war to do compile-time weaving in gdm-updater.war's pom.xml:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.4&lt;/version&gt;
      &lt;configuration&gt;
          &lt;showWeaveInfo&gt;true&lt;/showWeaveInfo&gt;
          &lt;source&gt;${compiler.version}&lt;/source&gt;
          &lt;target&gt;${compiler.version}&lt;/target&gt;
          &lt;Xlint&gt;ignore&lt;/Xlint&gt;
          &lt;complianceLevel&gt;${compiler.version}&lt;/complianceLevel&gt;
          &lt;encoding&gt;UTF-8&lt;/encoding&gt;
          &lt;verbose&gt;false&lt;/verbose&gt;
          &lt;aspectLibraries&gt;
              &lt;aspectLibrary&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
              &lt;/aspectLibrary&gt;
          &lt;/aspectLibraries&gt;
      &lt;/configuration&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;goals&gt;
                  &lt;goal&gt;compile&lt;/goal&gt;
                  &lt;goal&gt;test-compile&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;version&gt;${aspectj.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjtools&lt;/artifactId&gt;
              &lt;version&gt;${aspectj.version}&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/plugin&gt;   
  </code></pre>
  
  <p>I can't get anything working.
  I searched the web for answers and found a couple of links, but none seem to be relevant:</p>
  
  <p><a href="https://stackoverflow.com/questions/10698631/has-anyone-run-aspectj-with-jboss-as-7-1-1-final">Has anyone run AspectJ with JBoss AS 7.1.1 final?</a> - not relevant since I'm not using load-time weaving</p>
  
  <p><a href="https://issues.jboss.org/browse/AS7-3681" rel="nofollow noreferrer">https://issues.jboss.org/browse/AS7-3681</a> - not relevant since I'm not using load-time weaving or AspectJ as a Java agent</p>
  
  <p>I've considered load-time weaving, but the aspect in question will soon be expanded to include some features present in the rest of that "common" jar file, and I can't break that out to the boot classpath.  It would mean that every time we have a new aspect, we have to reconfigure the server.</p>
  
  <p>What am I doing wrong?</p>