Lucee Debug - VSCode

This tip and trick dated 2022-12-20 seems most promising. I don’t see any reference in our collection.

Has anyone successfully adjusted and used this method for debugging line by line within VSCode?

I’m stuck on where to place the necessary .jar and what to configure to point to it. The VSCode extension adds in nicely but plugging it into Lucee eludes me.

1 Like

A demo or step-by-step guide for installing and running the extention would be great for developers. Perhaps a simplified version for those who focus on coding, as DevOps teams typically handle container-related tasks for setting up the JAR files.

If using Tomcat, /opt/lucee/tomcat/lib/ (or its Windows equivalent) appears to be the best place for luceedebug.jar, though you can put it wherever you like (except most likely not /opt/lucee/lib/).

Then follow the instructions in the Install and Configure Agent section of the luceedebug GitHub repo README, making sure of course to change both occurrences of /abspath/to/luceedebug.jar in the -javaagent argument of your java invocation, for example in /opt/lucee/tomcat/bin/setenv.sh (or setenv.bat), to match the actual path of the jar file.

In my case it’s appended to the string value of the JAVA_OPTS environment variable, though it can also be CATALINA_OPTS.

Example:

JAVA_OPTS="-Xms512m -Xmx512m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:9999 -javaagent:/opt/lucee/tomcat/lib/luceedebug.jar=jdwpHost=localhost,jdwpPort=9999,debugHost=localhost,debugPort=10000,jarPath=/opt/lucee/tomcat/lib/luceedebug.jar";

Then restart Lucee.

You might also need to restart VS Code after you’ve installed the extension, then follow the instructions in the VS Code luceedebug Debugger Extension section of the README for configuring the JSON for the extension.

However, at this point I am stuck. Even though it appears to be connecting to Lucee, as the call stack in vscode Run and Debug has expected items such as various ajp-nio entries, references to Catalina, luceedebug-worker, main, etc, nothing appears in the VARIABLES nor WATCH areas. So either it’s not fully working, or I don’t know actually how to use vscode’s debugger because I’ve never used it before. Decades of old school dump debugging have served me well enough I guess. :wink:

Still it’s frustrating. Having followed all of the instructions and the extension getting a response from Lucee, it seems I’ve done everything properly, yet still no joy.