Updating Weld in Glassfish V3
(updated : This post refers to Glassfish installations prior to version 3.0.1 which was recently released and includes Weld version 3.0.1. Given the new version, this manual update is not necessary and should not be performed if you have an updated installation of Glassfish 3.0.1+)
Even some of the recent versions of Glassfish include a version of Weld, the reference implementation for CDI (JSR 299), that has some major issues. Since Glassfish uses OSGI, upgrading isn’t as easy as just replacing the jar with a new one. This tutorial shows you how to upgrade Glassfish to Weld 1.0.1.Final as well as including a pre-built distribution of the two files that need re-deploying.
One of the ways to get around the faulty version of Weld currently in Glassfish is to moving up to Glassfish 3.0.1 nightly builds (update : 3.0.1 has been released and should be used) . A less bleeding edge solution would be to upgrade the version of Weld that is deployed on your current version of Glassfish by updating the
weld-osgi-bundle jar files. However, one must be careful of the integration jar version as one of the major interfaces changed after the initial release of Weld introducing incompatibilities.
Updating the OSGI bundle is easy since it can be built from the Weld source code. Just download and compile it and locate the osgi-bundle.jar file.
We also need to grab a new version of the
weld-integration.jar file. There are all sorts of versions of this file, but the one I found working for Weld 1.0.1.final was version 3.0.1-b11/.
I’ve already built the osgi-bundle and grabbed the integration jar and verified that they work so I’ve renamed and zipped them so you can just download and unzip them into the
modules directory of your Glassfish v3 installation.
This is also a necessary step to get the Knappsack Java EE 6 demo project working under Glassfish. You can find more details on the server compatability page
2 thoughts on “Updating Weld in Glassfish V3”
Thanks for the pointers. I downloaded and installed latest glassfish v 3.0.1 but when I run a Java EE app with Weld/CDI support I still see Weld WELD-000900 1.0.1 (SP3) in the server logs. I downloaded the zip from your site and put it under glassfish/modules dir but I still get the same WELD-000900 1.0.1 (SP3) version. I was expecting to see WELD-000900 1.0.1 (Final) instead. What version do you see on glassfish server console/logs?
Hi Ashsish, Sorry for the delay, I kept meaning to look, and when I did, it was version Weld 1.0.1 (SP3) which is probably correct since 1.0.1-SP3 is a later version than 1.0.1-Final.
Incidentally, version 1.1.0 is out under the name 1.1.0-01-glassfish
Comments are closed.