Downgrade mysql-connector-java

I am running Coldfusion 2016 with CommanBox and need to downgrade the mysql connector to a previous version, in regards to this - Alert about MySQL Connector/J 8.0.23 - ColdFusion

I cannot figure out how to do this with CommandBox. Any help is appreciated! Thanks.

Check for the jar in the cfusion/lib folder.

Thanks. I tried to but couldn’t locate the cfusion folder for some reason.

Where did you look? There are a few easy ways to find this folder for a CommandBox server. The easiest is to click the tray icon for the server and select “Open” > “Server Home”.

image

Then from there, navigate to WEB-INF\cfusion\lib.

Another way to find your server home is to run this command in the web root of the server:

server info property=serverHomeDirectory

and that will show you where your server home lives for that server.

1 Like

Thanks Brad! I did see the WEB-INF folder but didn’t look in it since the “standard” CF install doesn’t put cfusion into it.

So I replaced the mysql-connector-java file with an older version (8.0.15), but when I go to CF admin settings page and look at CF Server Java Class Path, it still lists the newer version (8.0.25). And I did confirm the location of the file. I have restarted CommandBox and even my laptop, just in case.

What do I need to do here for CommandBox/Coldfusion to recognize that the file has been replaced by a different file?

Sorry, not sure I really understand what you’re asking. When exactly do you mean when you say

Lists where? lists how? Can you please include screenshots or something so we can understand what you’re seeing. I’m unclear if you’re on the add-datasource screen or the information screen that lists all the jars loaded, or something else…

Sorry about that. I meant that I saw reference to file “mysql-connector-java-8.0.25.jar” in CF Admin → Settings Summary → CF Server Java Class Path.

But when I look at that directory, all I see is my “new” file called “mysql-connector-java-8.0.15.jar”.

Thanks for your help!

Are you sure you replaced the jar in the correct folder? Did you restart the server after doing so?

Yes, I did verify that it was the correct folder.

In CF Admin, Settings Summary: /Users/felix/.CommandBox/lib/var/root/.CommandBox/server/0000BFE9FDDB8536A2AA8EE8CA10AFE5-mydev/adobe-2016.0.17.325979/WEB-INF/cfusion/lib/mysql-connector-java-8.0.25.jar

My new jar file’s location: /Users/felix/.CommandBox/server/0000BFE9FDDB8536A2AA8EE8CA10AFE5-mydev/adobe-2016.0.17.325979/WEB-INF/cfusion/lib

I did restart the server with stop and start commands, and even restarted my computer.

Now that I posted the two locations, I clearly see the problem. Sorry, and thanks again.

Weird, I don’t even have this folder “/Users/felix/.CommandBox/lib/var”

Yeah, you’ve got something fishy going on there. Have you set anything in your server.json to customize the server home directory? Also, are you starting your server with the felix user or the root user? I have no clue where the /Users/felix/.CommandBox/lib/var/root/.CommandBox folder came from and I’ve never seen that before.

I’m starting the server as super user in order to use port 80, otherwise it wont let me. And I don’t believe I did; here’s my server.json contents:

{
    "profile":"development",
    "name":"mydev",
    "openBrowser":true,
    "app":{
        "cfengine":"adobe@2016",
        "libDirs":"/Library/WebServer/servers/i4a/classes_8"
    },
    "jvm":{
        "args":"-Dcoldfusion.classPath=/Library/WebServer/servers/i4a/classes_8/ -classpath /Library/WebServer/servers/i4a/classes_8/"
    },
    "web":{
        "host":"mydev.i4a.com",
        "directoryBrowsing":true,
        "accessLogEnable":true,
        "maxRequests":30,
        "gzipEnable":true,
        "gzipPredicate":"regex( '(.*).css' ) and request-larger-than( 500 )",
        "aliases":{
            "/servers":"/Library/WebServer/servers",
            "/i4a":"/Library/WebServer/servers/i4a/root/htdocs",
            "/common":"/Library/WebServer/servers/common/root/htdocs",
            "/CKFinder_Connector":"/var/www/servers/common/root/htdocs/ckfinder/core/connector/cfm/",
            "/coldext":"/Library/WebServer/servers/common/root/htdocs/coldext",
            "/resources":"/Library/WebServer/servers/i4a/resources/",
            "/m":"/var/www/servers/i4a/root/htdocs/m/",
            "/m/":"/var/www/servers/i4a/root/htdocs/m/",
            "/var/www/servers":"/Library/WebServer/servers"
        },
        "customTagPath":[
            "/Library/WebServer/servers/i4a/components/",
            "/Library/WebServer/servers/i4a/customtags/"
        ],
        "HTTP":{
            "enable":true,
            "port":80
        },
        "SSL":{
            "enable":true,
            "port":443,
            "certFile":"/etc/ssl/sites/mydev/mydev.pem",
            "keyFile":"/etc/ssl/sites/mydev/mydev.key"
        }
    }
}

So this is probably the root of the issue. When you ran the

server info property=serverHomeDirectory

command to find the server home, did you ALSO run that command as root? Because if not, you’ll get the wrong answer! For every user CommandBox is run, it will create a separate CommandBox installation in that user’s home dir, with separate servers, settings, modules, etc, etc. Your felix user and root user are basically two completely different accounts and they get their own totally separate CommandBox installations!

The fix for this is fairly simple- you can just “pin” the CommandBox home dir to a shared folder so all users now use the same installation. Use a commanbox.properties file as discussed here in the docs:

and choose a folder that all users will have read/write access to.

That definitely worked :slight_smile: Thanks Brad!

1 Like