On 2/26/2024 2:18 PM, Mark Caruso wrote:
If anyone has guidance for configuring Tomcat 9.0.85 for debugging please send 
it along. I am running the program under Ubuntu 20.04. I am not sure the 
guidance on the internet for modifying catalina.sh is right.  My goal is to 
then attach a debugger from Netbeans 16 and debug my web app.
Thank youMark

Mark,

In my opinion, running a service-oriented (systemd for Ubuntu 20.04) or package-installed Tomcat for development and debugging is not ideal.

In no particular order, you'll run into:

1. Start / stop issues (you'll need sudo)
2. Log permissions (looking at logs may be an issue)
3. Deployment permissions (more about that below)

Also, NetBeans 21 just came out and is available via snap. Is there any reason to run NetBeans 16?

NetBeans allows you to start up a Tomcat instance in normal, debug, or profile mode from the IDE. It does this by using the Tomcat-provided catalina.(sh/bat) script. That's going to be an issue if you're using a package-installed Tomcat.

In the NetBeans server setup, you can either use shared memory or JMX (and specify the port) for a Tomcat server. By default, NetBeans will use shared memory for a Tomcat running on the same machine.

NetBeans deploys an application to Tomcat that it controls by copying a context.xml file over to the appropriate location in a Tomcat installation ($CATALINA_HOME/conf/Catalina/localhost/appname.xml) with an appropriate docBase. For example, if you are running a Maven project, that docBase will be:

${project.basedir}/${project.build.directory}/${project.artifactId}-${project.version}

This enables a project to be deployed quickly, as well as enables hot reloads if you enable compile on save.

Deploying and redeploying a web application for debugging may run into permissions issue if you're using a package-installed version of Tomcat.

So, in summary:

1. Download Tomcat from tomcat.apache.org
2. Extract and install it in a reasonable spot underneath your home directory
3. Edit server.xml to change any ports (if necessary)
4. Edit tomcat-users.xml to add a user with a manager-script role (see comments in file)
5. Configure NetBeans to use the freshly installed Tomcat

Debugging is then simply starting Tomcat in debug mode. This is how I work on Windows, Ubuntu, Fedora, and have people set up on MacOS.

. . . just my two cents
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to