Debug an Ubuntu/Debian Tomcat User Instance

tomcatI sometimes work on web application code that I test by deploying into a Tomcat servlet container. I develop on Ubuntu-based systems, and like to use the tomcat7-user (and/or tomcat8-user) package for testing. I believe this package is also available on Debian systems.

$ sudo apt-get install tomcat7-user

Once installed, a new command is available for creating local Tomcat instances. It saves me from dealing with a globally configured Tomcat server on my system:

$ tomcat7-create-instance my-tomcat
$ cd my-tomcat/bin
$ ls
$ cat
export CATALINA_BASE="/home/dale/my-tomcat"
echo "Tomcat started"

Of course, the CATALINA_BASE value in your script will be slightly different. Sometimes I want the ability to connect an interactive debugger to my application’s running server-side code. The provisioned startup script doesn’t provide an easy way to enable JPDA so that I can do this. Let’s create a script that will:

$ cp

Use your favorite editor to modify so it looks as follows:

export CATALINA_BASE="/home/dale/my-tomcat"
/usr/share/tomcat7/bin/ jpda start 
echo "Tomcat started in debug mode" 

I use Eclipse as my development environment. If you do, too, then you can follow the useful guide at to connect the interactive debugger to your application.