You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Caruso <ma...@ymail.com.INVALID> on 2024/02/26 22:18:42 UTC

configuring Tomcat 9.0.85 for debugging

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




Re: configuring Tomcat 9.0.85 for debugging

Posted by Mark Caruso <ma...@ymail.com.INVALID>.
 Thank you very much!

    On Monday, February 26, 2024 at 05:43:02 PM EST, Chuck Caldarale <n8...@gmail.com> wrote:  
 
 
> On Feb 26, 2024, at 16:18, Mark Caruso <ma...@ymail.com.INVALID> 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.


Might want to start with the Tomcat FAQ, in particular this page:
https://cwiki.apache.org/confluence/display/TOMCAT/Troubleshooting+and+Diagnostics

  - Chuck

  

Re: configuring Tomcat 9.0.85 for debugging

Posted by Chuck Caldarale <n8...@gmail.com>.
> On Feb 26, 2024, at 16:18, Mark Caruso <ma...@ymail.com.INVALID> 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.


Might want to start with the Tomcat FAQ, in particular this page:
https://cwiki.apache.org/confluence/display/TOMCAT/Troubleshooting+and+Diagnostics

  - Chuck


Re: configuring Tomcat 9.0.85 for debugging

Posted by Mark Caruso <ma...@ymail.com.INVALID>.
 Mark
Your input is very helpful.  Thank You very much!  I have been having headaches with all the issues you mentioned and will be following your guidance.

    On Monday, February 26, 2024 at 06:12:49 PM EST, Mark Eggers <it...@yahoo.com.invalid> wrote:  
 
 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

  

Re: configuring Tomcat 9.0.85 for debugging

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org