Updating Weld in GlassFish 4

GlassFish uses Weld, the CDI Reference Implementation, as its CDI implementation. More specifically, GF 4.0 Open Source Edition is using Weld 2.0.0.SP1. Unfortunately, there’s an issue related to the Weld GF integration that can arise when using JSF. To work-around this, you just need to replace, in your GlassFish 4 setup, the Weld 2.0.0.SP1 release with the latest Weld 2.0.5 release.

0. Backup the original Weld implementation
mv glassfish/modules/weld-osgi-bundle.jar /backup

1. Grab the Weld 2.0.5 OSGi bundle and copy it to the GF modules directory
cp weld-osgi-bundle-2.0.5.Final.jar glassfish/modules/

2. Restart GlassFish
glassfish/bin/asadmin restart-domain domain1

3. You check which version is now installed by issuing
glassfish/bin/asadmin osgi lb | grep 'Weld OSGi'osgiweld

The usual disclaimers : “Use at your own risk”, “Don’t do this at home”, “Wrestlers are trained professional athletes. You should never try to emulate what they do in and out of the ring”,