Eclipse remote Debugging appears "JDWP transport Dt_socket failed to initialize" How to Troubleshoot

Source: Internet
Author: User
Tags tomcat

You often need to use Eclipse remote connection tomcat to debug your Web application.

Eclipse Remote Debugging Tomcat method

1. Configuring Tomcat in Linux is added as follows in catalina.sh


Catalina_opts= "-xdebug-xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" (Do not change lines, to be on the same line)

2. Modify Catalina,bat file in window, add:

Set "Catalina_opts=-xdebug-xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

As shown in figure:


Parameter description:

-xdebug: Enable debug mode

-xrunjdwp<sub-options>: Loading the JVM's JPDA reference implementation Library

Transport=dt_socket:socket connection, optional Dt_shmem connect to the debug server through shared memory

address=8000: The port that the debug server listens on

Server=y: Is the server side, N is the client

Suspend=n: The boot process does not load pause, Y is paused during startup, easy to debug the startup process

3, start Tomcat to see if Tomcat started successfully,

If the startup succeeds, the Tomcat log file (Catalina.out) will have the following input:

Listening for transport dt_socket at address:8000

4. Debug with Eclipse:


When you click Debug, you can debug.


The rest is the same as normal debugging. Breakpoints are added directly to the source code.

5. Possible connectivity issues:

Failed to connect to remote VM. Connection refused.

Connection Refused:connect.


The situation that appears as shown in the picture may be that a connection has been established.

Workaround: Go to the debug perspective,

Find clicks

You can resolve the problem by disconnecting the link.



But there may be a few minor problems with doing the above method. When you restart Tomcat for the first time after you change Tomcat's profile catalina.sh on a remote server, there is generally no problem (note that the debug port number of the setting does not conflict with other existing application port numbers), but the following problems may occur during subsequent reboots:

CD Tomcat/bin
./shutdown.sh;/startup.sh; Tailf. /logs/catalina.out

Error:transport ERROR 202:bind failed
ERROR:JDWP transport Dt_socket failed to initialize , Transport_init (510)
JDWP exit Error Agent_error_transport_init (197): No transports initialized [... /.. /.. /SRC/SHARE/BACK/DEBUGINIT.C:690]
FATAL ERROR in native method:jdwp No transports initialized, Jvmtierror=agent_ Error_transport_init (197)

occurs because the debug port we added does not shut down properly when Tomcat is turned off and reboots when restarted, so the port is occupied, We can use the following command to verify after turning off Tomcat that there is still a process occupying the debug port.

lsof-i:44121 (or Netstat-na|grep 44121)

This is actually what we started before. Of course we can kill the process manually after each shutdown, but that's not the solution. The better way I think about it now is when you configure the debug port in catalina.sh, add the line that you want to add to the beginning of the start condition and add the

debug_pid=lsof-i:44121 to the start of the stop condition | Tail-n 1 | Awk-f "" ' {print $} '
Kill-9 ${debug_pid}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.