title: Glassfish: Weld won't inject from classes in one jar to classes in an adjacent jar in WEB-INF/lib
body: <p>I'm having trouble using dependency injection (with CDI/Weld) within libraries used in a war when deploying on Glassfish 3.1. I have two libraries, say:</p>
  
  <pre><code>WEB-INF/lib/library1.jar
  WEB-INF/lib/library2.jar
  </code></pre>
  
  <p>library1 contains a public class, say "InjectMe". Library2 contains another public class, say "InjectionTarget" with an injection site like "@Inject public InjectMe injectMe;" .</p>
  
  <p>Deployment fails with:</p>
  
  <pre><code>WELD-001408 Unsatisfied dependencies for type [InjectMe] with qualifiers [@Default] at injection point [[field] @Inject packagename.InjectionTarget.injectionSite].
  </code></pre>
  
  <p>Both archives are valid CDI archives with a META-INF/beans.xml .</p>
  
  <p>I've updated weld-osgi-bundle.jar in Glassfish 3.1 and still see the issue.</p>
  
  <p>If I manually unpack library1 and library2, putting their classes directly into WEB-INF/classes, deployment succeeds and injection works as expected.</p>
  
  <p>This is rapidly driving me completely insane. I'm on the verge of restructuring my modules so that the jar subpackages are unpacked with maven-dependency-plugin and archived as a merged jar that I then depend on from my war. That's pretty gruesome, though.</p>
  
  <p>Ideas? Shouldn't this "just work"?</p>