I wonder if you have encountered the following situation:

[China server 1 test] : There is a bug in my local environment, that “snow porridge” you come and have a look.

Or:

[national service first test] : the official Internet service out of a bug, I guide the database environment to the local, looked at the next is indeed a bug, the [porridge snow] you come to see.

Or:

[China first Dog] : How can there be a bug in the Intranet server again, that [snow porridge] you come and have a look.

Then, I see every time is a fart dian fart passed

[porridge snow] : Oh, there is a bug, the XXX, you will send me the database, and the corresponding account to me, I try the local, and then come back is the operation of three: Pull corresponding version code, guide database, break point, use the corresponding account to reproduce the bug, and guide database is the most chicken trouble one thing, because a database a few G you guide to see.

Later, as a clever and witty person, I wondered if there was a way to connect the idea of my computer directly to the engineering environment of the other party for remote debugging. Checked on the net afterwards, oh huo, return really have

Let me tell you how to deal with this dark technology, if you are interested in it, you can try it on your own project team, trust me, you will be praised after using it!!

In my previous group chat chat rooms, for example, natural you can just find a project, I just figure a convenient, have two local environment, is a packaged jar package, the first test of the jar to the dress of the engineering environment, and the other environment on my local engineering environment, then start the idea of black science and technology of performance:

  1. To enable remote debugging for the first test server [remote server] project, the method is super simple, when starting with specific JVM parameters, these parameters are:

    -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

    As you can see, 5005 is used to provide a port for remote debugging connections. For example, to support remote debugging, the command line for starting jar packages should now be changed to

    Java - agentlib: JDWP = transport = dt_socket, server = y, suspend = n, address = 5005 - jar chatRoom - 0.0.1 - the SNAPSHOT. The jar

    You can see what’s going on here

  2. Next is my local IDEA Settings, local IDEA here to add a startup environment, start remote debugging mode, the steps are as follows

The Host input is the IP address of the first test server, and the Port input is the IP address of the first test server, and the Port input is the IP address of the first test server

The explanation starts successfully, already connected the debugging of remote server, look for a landing interface to hit a breakpoint to see

After accessing the login interface of the remote server, you can see

Well, the remote debugging is successful, and then the project team can promote a wave of, and then is a big praise.

For our project team, this kind of remote debugging is really very convenient. In the future, if we meet the first test or the first plan of the gou, we can reply directly, just give me your IP and a database!!

Here’s how it works: The JVM itself to support remote debugging, so also is not the idea itself, the credit of the JVM itself provides a simple debugging tools JDB, allows you to set breakpoints and debug thread, different JVM by the agreement of the interface connection at the same time, the local environment can establish contact and communication, remote JVM idea here is to do the support of this layer, In fact, Eclipse supports it.