Idea 2017 remote debugging tomcat8 notes

Usually, the computer used for self-development is Windows system, and the test environment is generally linux system. Due to the difference of the system environment, sometimes the program can be executed normally in the local environment, but it will stop in the test environment. In order to solve this kind of problem conveniently, the best way is to be able to debug the server code remotely. On the whole, it is easy to configure, but some pits will be encountered unexpectedly. This article mainly makes a record of the pits that I have encountered, as a memo for myself, and also for the convenience of students who have similar experiences.

 

Referring to the experience of predecessors, to sum up, the configuration is mainly divided into two steps:

1. Open the tomcat remote debugging port

2. Using IDE, I am currently using Idea, debug mode to connect to the remote port

 

For specific steps, see the following article

Reference document: http://blog.csdn.net/mhmyqn/article/details/49209541

 

Generally speaking, this configuration is basically enough. However, like me, after configuration, start the idea debugging, always report "Unable to open debugger port (ip:8908): java.net.ConnectException "Connection refused: connect"". Sort out the ideas: idea has already suggested that the error was reported when connecting to the debug port, and it was a network problem. So, idea already knows that remote debugging is required, so there should be no problem here; since it is a port, will it be In the first step, the debugging port of tomcat is not opened? In this case, check the tomcat startup log and find that the startup is normal, and "Listening for transport dt_socket at address: 8908". It seems that the first step should also be successful, why can't it be debugged?

So I searched the Internet and asked the seniors. See that some people say that it may be a port conflict, but netstat -apn|grep 8908 shows that it does not. Later, in the notes of a senior, I finally found the possible cause of the problem and its solution: If the "127.0.0.1 localhost" in the host file of the linux environment is deleted, the debugger cannot locate the host. I opened the host file of my test environment and found that there was a mapping of this sentence, and I was disappointed, but there were some very strange mappings after that, so I wondered if these strange things caused "127.0.0.1 localhost" to not take effect, so I tried Move this mapping to the end of the host file, then restart tomcat, re-debug the connection, and call the interface test. Problem finally solved.

 

Reference document: http://blog.csdn.net/tjns8/article/details/51046504

 

Postscript: After a few remote debugging, I found another problem: after the idea is started for the first time to debug, if it is restarted again, it will fail to connect again. At this point, restart the server tomcat again.

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326594517&siteId=291194637