Lucee 5, OSGi and changing a bundle

I’m running Lucee 5 and the MySQL driver shipped with the MySQL extension is ConnectorJ version 5.1.20, which is from 2012 and I want to update to the latest driver 5.1.38 as I’m getting an error which I believe is caused by the driver being too old for the version of MySQL server I’m running, 5.6.

In the past I would just have removed the old ConnectorJ JAR file from the /lib/ directory and replaced it with the new version JAR file, restarted Lucee and everything would work, however now that isn’t possible as the JAR has to be an OSGi bundle, Lucee is configured (via the extension I think) to look for version 5.1.20 and if it’s not there automatically download it, etc… etc…

My understanding was OSGi was going to make it easier to use different versions of the same JAR, however I have no idea at all now how to go about changing the MySQL OSGi bundle for a newer version, where I would get the newer version from, how the bundle relates to the extensions, etc…

@micstriit - Is it possible to explain this and the process for using a newer driver version, etc… please. Thanks.

1 Like

First step is to convert the jar we need to an OSGi bundle and publish on a Maven Repo (ours or central maven). So best we search on for MySQL, if we found it, we download it unpack it (it is a zip) and look into the file MET-INF/, if there is a “Bundle-Symbolicname” and “Bundle-Version” it is a OSGi bundle and we are fine. If not we need to convert it to an OSGi Bundle and publish on our Maven Repo. To convert a jar to a osgi bundle the cfadmin tag has a action “buildBundle”, I can give you an example for this. Then we use the github “mvn” project to publish our new bundle.
All this steps are not specific to jdbc, they are about generate and publish an Osgi bundle. Publish the bundle on maven repo make it not necessary to bundle the bundle with the extension, so not really necessary but I do this for all bundles. Just in case someone clear the bundles directory Lucee can download them new.

Jdbc drivers need to be registered with Lucee, because of that you should always install it as an extension. Building a jdbc driver is very easy, get the github project " jdbc drivers" and then add osgi bundle to an existing folder under /builds/ or add a new one. Run ant and you are done.

MySQL already is available in the latest version, I did this a couple days ago, so you can simply download it on the download page, latest builds will also bundle this version.

It is also possible, using Maven, to pull the jar file and update it’s manifest with OSGi information. I created an extension project that does this for a particular JDBC driver I was wanting to use. I’ll see if I can put up an example.

creating a JDBC extension is very simple, get this project and add a new folder to the build folder, use one of the other folders as a template

for converting jar to OSGi bundle use this example