how to start tomcat debug port in windows while debugging tomcat application
Solution 1
Basic config is:
In catalina.bat
under tomcat/bin
file modify the below.
CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
- Run Tomcat from command prompt:
catalina.sh jpda start
Then in eclipse create a debug configuration:
- Write any name for the configuration.
- Write the project name.
- Write the connection type as Standard(Socket Attach)
- Host should be localhost
- Port as 8000( or any port number, but that should be the same in other places also).
see: Remote debugging Tomcat with Eclipse
Solution 2
When run as windows service, Tomcat's command line options could be stored in registry at HKLM\Software\Wow6432Node\Apache Software Foundation\Procrun 2.0\TomcatServiceName
path for 64-bit OS and at HKEY_LOCAL_MACHINE\Software\Apache Software Foundation\Procrun 2.0\tomcat8
for 32-bit.
See Where does Tomcat7w.exe store Settings on Windows.
Those settings can be viewed and changed via running bin\tomcatw.exe
.
![ThinkTank](https://i.stack.imgur.com/TVqZC.png?s=256&g=1)
ThinkTank
By Day: I will be available but I am not answering that means I am in the different timezone. By Night: I sleep like the hog. Interests: Learning new things which keeps me updated, and love mountains and trekking.
Updated on June 28, 2022Comments
-
ThinkTank about 2 years
I'm getting Exception while debugging
Failed to connect to remote VM. Connection refused. Connection refused: connect.
i have tried command in windows system
netstat -n -a -p tcp
but my port 8787 was not there how to start that port.
-
ThinkTank about 8 yearsby default eclipse is taking 1043 as a port now. how i don't know?? when i am trying to do with eclipse UI but now it is taking default port where it is defined?
-
KlajdPaja about 8 yearsNo one else has given a hint so I'll give a shot by searching for JPDA_OPTS in all .bat files inside bin but it should be in catalina.bat or setenv.bat
-
ThinkTank about 8 yearsdt_socket port is by default at startup 1043 how please help me. while manually starting tomcat 7.
-
KlajdPaja about 8 yearsIf you start it manually specify the port like this, in windows:
bin\startup.bat -debug 8000
-
ThinkTank about 8 yearsthen i get socket error but after configuring in eclipse port number 1043. when manually starting it takes 1043 as port number.
-
KlajdPaja about 8 yearswell that might be because the port is being used by another process, so try another port or kill that process
-
ThinkTank about 8 yearsafter using telnet i am not able see that port also
-
ThinkTank over 7 yearsThanks,I have changes in catalina.bat also seen many options such as
-Xmx,-XX:PermSize
etc thanks again.