Remote debugging of the Tomcat application with VSCode - NIAGADS/GenomicsDBWebsite GitHub Wiki
- Edit/create if does not exist:
$CATALINA_HOME/bin/setenv.sh
to add the following line:
# allow remote application debug
JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=<tomcat port>,server=y,suspend=n"
NOTE:
<tomcat port>
is the port on which your tomcat is running (default: 8080)
- In VSCode select
Debug > Add Configuration
from the menu; copy and paste the following in to thelaunch.json
file that gets opened:
{
"type": "java",
"name": "WDK-Tomcat",
"request": "attach",
"hostName": "localhost",
"port": <tomcat port>,
"projectName": "niagads-website-model"
}
NOTE:
<tomcat port>
is the port you specified in yourJPDA_OPTS
- Start the tomcat application in debug mode
sudo -u tomcat $CATALINA_HOME/bin/catalina.sh jpda start
NOTE: The
sudo -u tomcat
may be optional depending on how your system is configured
FYI: if you start with
jdpa run
instead ofjdpa start
tomcat will log in the current terminal window
-
In VSCode, select
Debug > Start Debugging
from the menu -
To stop the tomcat application (after starting w/the
catalina.sh
use the following command:
sudo -u tomcat $CATALINA_HOME/bin/catalina.sh stop