start tomcat with debugging mode

时间:2022-02-06 16:49:08

For this, you must run your application in debug mode, which requires below parameters.

-Xdebug -Xrunjdwp:transport=dt_socket, server=y, address=<<port number>>, suspend=n

Parameter
Description
-Xdebug enables the application to be debugged.
-Xrunjdwp loads the reference implementation of the JDWP(Java Debug Wire Protocol), which enables remote debugging
transport name of the transport to be used when debugging the application.dt_socket for a socket connection.
server y – application listens for a connection at the specified address.
n – application attempts to attach to a debugger at the specified address.
address specifies a port number used for communication b/w the debugger and application.
suspend n – application starts immediately.
y – application waits until a debugger has attached to it before executing.

following pics could show  the instance how I set the parameter:

start tomcat with debugging mode

key thing we must focus on is to look for where we could set parameter,usually scripts that start up tomcat  will set env.

so we could determine where we could populate parameter .

start tomcat with debugging mode

actually, sometime the address will be occupied by other process at linux, for instance,tcp process perhaps use the address port.

it may cause that tomcat cann't get started, if meet this issue. we need to check out catalina.out lo, then,we will find out the solutions or cases that changing address value could solve it.