title: Weld 001508 exception on Glassfish 4: how to ignore interface(s)?
body: <p>Problem: I keep getting the WELD exception below when trying to deploy my WAR to Glassfish 4.1.1. The application deploys properly on Wildfly 9.0.</p>
  
  <blockquote>
    <p>Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.jboss.weld.exceptions.DefinitionException: <strong>WELD-001508: Cannot create an InjectionTarget from [EnhancedAnnotatedTypeImpl] public abstract interface @Path class com.example.package.MyService as it is an interface</strong></p>
  </blockquote>
  
  <p>Here, <code>MyService</code> is indeed an interface, defined in a separate library. My application pulls the library in so it can create a proxy against the <code>MyService</code> interface and make requests. <code>MyService</code> looks like:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Path("api")
  public interface MyService {
  
      @GET
      public void someMethod();
  }
  </code></pre>
  
  <p>I tried excluding <code>MyService</code> from WELD by adding the following to the <code>beans.xml</code> file, to no avail :(</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;scan&gt;
      &lt;exclude name="com.example.package.*"&gt;&lt;/exclude&gt;
  &lt;/scan&gt;
  </code></pre>
  
  <ul>
  <li>Why is WELD trying to include that library's interface?</li>
  <li>How do I tell it to ignore it?</li>
  </ul>