1. what is the port number I can use ? When I installed the app server I used 8080 as HTTP port, which means all the local host application uses 8080 port. Here, in the above syntax, should I use address = 8080 ? I tried, but then when I started the server I got "port conflict" error. Shall I use a different port number here ? If yes, then it is really strange -- Since my application runs on 8080 HTTP port, how can I use a different port (say, 7000) for debugger port ? You are not going to see anything from http://localhost:7000/myapp ! Everything is run on http://localhost:8080/myapp, right ?
2. Anyway, I tried a different port (8000) instead of 8080 HTTp port, and in Myeclipse, I configured an "external lanuched server". From there I specify "8000" to be consistent, then when I click "debug", it showed "failed to connect to remote VM". So, what's the problem ?
Since my application runs on 8080 HTTP port, how can I use a different port (say, 7000) for debugger port ?
Because the debugger client program is NOT the web client program. The debugger is an independent server that's running inside the JVM at the same time that the web application server itself runs in the JVM. So you absolutely MUST run the debugger server on a different port than the one that handles the web requests. The debugger doesn't even use the same protocols as the web!
In fact, since TCP/IP only allows one server to own a port, your choice of debugger port not only cannot be one of the ports held by the application server (Tomcat actually uses about 5 different ports), it also cannot be any other port that's in use on your system. The netstat command can help you find out what ports are being listened on.
The only requirement for using Java remote debugging is that both the debugger client (in Eclipse) and the debugger server (in your web application server) both specify the same port number. In other words, if the debugger was started using port 7992, the debugger client has to be configured to talk to port 7992.
An IDE is no substitute for an Intelligent Developer.