Glassfish: Weld will not enter from classes in one bank to classes in a neighboring bank in WEB-INF / lib

I'm having problems using dependency injection (with CDI / Weld) in the libraries used in the war when deploying to Glassfish 3.1. I have two libraries, say:

WEB-INF/lib/library1.jar WEB-INF/lib/library2.jar 

library1 contains a public class, such as "InjectMe". Library2 contains another public class, for example, "InjectionTarget" with an incubator site, for example, "InIndex InjectMe injectMe" ;.

Deployment Failed:

 WELD-001408 Unsatisfied dependencies for type [InjectMe] with qualifiers [@Default] at injection point [[field] @Inject packagename.InjectionTarget.injectionSite]. 

Both archives are valid CDI archives with META-INF / beans.xml.

I updated the weld-osgi-bundle.jar file in Glassfish 3.1 and still see the problem.

If I manually unpack libraries1 and library2, putting their classes directly in WEB-INF / classes, the deployment succeeds and the injection works as expected.

It quickly drives me crazy. I am on the verge of restructuring my modules, so jar subpackages are unpacked using the maven-dependency-plugin module and archived as a joint bank, on which I then depend on my war. It's pretty awful though.

Ideas? Shouldn't this β€œwork”?

+4
source share
2 answers

Did you encounter this error?

https://issues.jboss.org/browse/WELD-846

http://java.net/jira/browse/GLASSFISH-15721

http://java.net/jira/browse/GLASSFISH-15735

I think Glassfish 3.1.1-b04 and a newer use of Weld 1.1.1.Final, which is flagged as a fix version for the Weld base error. Testing with this exact version may be enough to confirm this.

+3
source

This turned out to be a PEBKAC error. I updated the weld-osgi-bundle.jar file on the desktop and workstation, but not on the laptop, but I thought I updated it on the laptop as well.

If you read this, you probably have a similar problem. Check the weld version with:

 asadmin list-modules | grep org.jboss.weld.osgi-bundle 

(Windows users: use findstr instead of grep, but the command hasn’t changed otherwise).

You should get the result:

 Module : org.jboss.weld.osgi-bundle:1.1.1.Final 

If you see an older version, upgrade the welding-osgi-bundle according to the instructions here:

 http://seamframework.org/Seam3/CompatibilityHome#H-UpgradingWeldInGlassFish31 

These instructions apply even if you are not using Seam. Weld 1.1.1 fixes several significant bugs in CDI. It's outside of me why Glassfish 3.1.2 was not released with it, because these are important fixes.

+3
source

All Articles