title: Why is my Interceptor not working?
body: <p>I have two different projects: A and B.</p>
  
  <p>B contains one Interceptor that I'd like to use in project A and, in the future, projects C and D.</p>
  
  <p>I'm using jboss-javaee-6.0 version 3.0.3.Final in both projects (this means, CDI version 1.0).</p>
  
  <p>Project B (does not contain beans.xml):</p>
  
  <pre><code>@InterceptorBinding
  @Target({TYPE, METHOD})
  @Retention(RetentionPolicy.RUNTIME)
  public @interface PerformanceLog {
  }
  
  @Interceptor
  @PerformanceLog
  public class LoggingInterceptor {
      private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
  
      @AroundInvoke
      public Object logMethodEntry(InvocationContext ctx) throws Exception {
          LOG.debug("Entered method (" + ctx.getMethod().getName() + ") of class (" + ctx.getMethod().getClass() + ").");
      }
  }
  </code></pre>
  
  <p>Project A (contains beans.xml):</p>
  
  <p>beans.xml (declares Interceptor in order to activate it):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt;
  
  &lt;interceptors&gt;
      &lt;class&gt;commons.utils.logging.performanceInterceptor.LoggingInterceptor&lt;/class&gt;
  &lt;/interceptors&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>MyControllerC:</p>
  
  <pre><code>@Named
  @RequestScoped
  public class MyControllerC implements Serializable {
       ... 
  
      @PerformanceLog
      public void init() {
         //do some BD access here
      }
  }
  </code></pre>
  
  <p>When I deploy the application I get the error </p>
  
  <pre><code>weblogic.management.DeploymentException: org.jboss.weld.exceptions.DeploymentException: WELD-001417 Enabled interceptor class &lt;class&gt;commons.utils.logging.performanceInterceptor.LoggingInterceptor    &lt;/class&gt; in file:/D:/projectos/myProject/target/myProject/WEB-INF/beans.xml@7 is neither annotated @Interceptor nor registered through a portable extension:org.jboss.weld.exceptions.DeploymentException:WELD-001417 Enabled interceptor class &lt;class&gt;commons.utils.logging.performanceInterceptor.LoggingInterceptor&lt;/class&gt; in file:/D:/projectos/myProject/target/myProject/WEB-INF/beans.xml@7 is neither annotated @Interceptor nor registered through a portable extension
  at org.jboss.weld.bootstrap.Validator.validateEnabledInterceptorClasses(Validator.java:503)
  at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:373)
  at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
  at com.oracle.injection.provider.weld.WeldInjectionContainer.start(WeldInjectionContainer.java:110)
  at com.oracle.injection.integration.CDIAppDeploymentExtension.initCdi(CDIAppDeploymentExtension.java:76)
  </code></pre>
  
  <p>My first tought was that because the Interceptor is inside a jar that's in project A lib, it was not visible. I upgraded to java-ee 7 version 1.0.3.Final and CDI 1.1 so that I could use the tag @Priority in LoggingInterceptor. The error disappeared, however it did not work (nothing was written to log). So I got back to java-ee 6 version 3.0.3.Final and CDI 1.0.</p>
  
  <p>I'm guessing that maybe I cannot find the Interceptor because the path in beans.xml is not the correct one in the jar (it is inside \WEB-INF\lib\loggings-1.2.jar\commons\utils\logging\performanceInterceptor).</p>
  
  <p>Does anyone have an idea of what might be wrong?</p>