I am developing with CommandBox CLI v6.2.1 on Windows 10, and running Lucee v6.2.2.91 successfully. I have added an MSSQL datasource to the server’s .cfconfig.json, and I am attempting to run a query via cfquery tag:
<cfquery name="GetPage" datasource="myDSN">
SELECT *
FROM Pages WHERE scriptName like <cfqueryparam value="#listlast(cgi.script_name,"/")#" cfsqltype="CF_SQL_VARCHAR">
</cfquery>
Where “myDSN” is the identifier of the datasource. I receive this error:
java.lang.RuntimeException:lucee.commons.lang.ClassException: cannot load class through its string name, because no definition for the class with the specified name [null] could be found
And the stack trace points to the closing tag. FYI, I have placed the MSSQL driver .jar in my .CommandBox\lib\ directory.
I also want to share my server.json:
And I also just discovered that this error does not occur when I remove the “app” struct above, meaning that I am not overriding the default Lucee version.
This sounds more like a Lucee question than a CommandBox one. To start, is there a reason you’re using a custom JDBC jar and not one of the pre-packaged Lucee JDBC extensions. They have both JDTS and Microsoft drivers.
That would be fine if you wanted to use the DSN from the CLI, but for a server point to your own lib directory in your server.json’s app.libDirs setting.
To start, is there a reason you’re using a custom JDBC jar and not one of the pre-packaged Lucee JDBC extensions.
No reason except lack of knowledge. Do you have a resource you could point me to for how to use one of the prepackaged extensions, specifically for Microsoft?
for a server point to your own lib directory in your server.json’s app.libDirs setting.
Based on the previous question it seems like I don’t need this, so I’ll remove the custom jars.
I would check the Lucee docs for that. I am the lead developer of CommandBox, and a Lucee user, but I am not a Lucee maintainer. I’m fairly sure the MSSQL JDBC drivers come pre-installed in Lucee, so you just need to log into the admin web UI and choose that driver from the drop down when creating your DSN. If that driver doesn’t show as installed, go to the “Applications” menu and install it.
you just need to log into the admin web UI and choose that driver from the drop down when creating your DSN
That would have been my first path, except that I was also having trouble accessing the admin web UI. After running my server with box server start, I request http://127.0.0.1:49566/lucee/admin/server.cfm, but that gives me Page [/lucee/admin/server.cfm] not found. I’ve also tried /lucee/admin.cfm, /lucee/admin/web.cfm, and /lucee/admin/index.cfm.
Changes are, the site is in production mode and you are accessing the web UI from outside of local host. Perhaps Docker? The --verbose output of the start command will tell you exactly what the profile is and whether the admin is being blocked. Switch the profile to development in your server.json or via a server start param, or via an env var. I’d need to know more details to provide better help.
After adding "profile": "development" to my server.json, then server forget and server starting again, everything is working now (although I get an MSSQL authentication error but that is unrelated).
Thank you!