A quick search of the Glassfish folder structure identifies the Weld implementation:
$ find /opt/sun/glassfish/ -iname '*weld*' /opt/sun/glassfish/glassfish/modules/weld-integration-fragment.jar /opt/sun/glassfish/glassfish/modules/weld-integration.jar /opt/sun/glassfish/glassfish/modules/weld-osgi-bundle.jar
The weld-osgi-bundle.jar is the file we have to replace. But how does one go about creating such an OSGI bundle? I for one am not an OSGI expert, and I'm sure I'm not alone :P
Update: The Weld OSGI bundle is now published to the maven repository. Instead of building it yourself, you can download it via:
Not to worry, the weld guys have this in hand. The OSGI bundle is built as an artifact during the weld build. To begin, proceed to the Weld core github page, and checkout the project:
git clone https://github.com/weld/core.git cd core
I had a bit of trouble building the entire project, due to the requirement of some deprecated artifacts. So just build the impl module in core:
cd impl mvn clean install
Next, build the OSGI bundle:
cd ../bundles/osgi/ mvn clean install
Now take that newly created Weld OSGI bundle, and use it to replace the Glassfish weld-osgi-bundle.jar file we located earlier.
cp target/weld-osgi-bundle-1.1.0-SNAPSHOT.jar /opt/sun/glassfish/glassfish/modules/weld-osgi-bundle.jar
Restart Glassfish, and you should see a message in the log file along the lines of:
INFO: Updated bundle 75 from /opt/sun/glassfish-3.1-b41/glassfish/modules/weld-osgi-bundle.jar
And there you have it, Glassfish 3.1 running with the latest Weld. Thanks to Stuart Douglas who guided me through the process!
Note: this will not work to get Weld 1.1+ to run on Glassfish 3.0.1, as the interface between Glassfish and Weld changed considerably with Weld 1.1/Glassfish 3.1. However that interface is for the most part stable, so we can use newer releases of Weld on Glassfish 3.1.