File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes remote debug from myeclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "remote debug from myeclipse" Watch "remote debug from myeclipse" New topic

remote debug from myeclipse

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
I start my app server (sun java system) from command line script. I added

java-config debug-enabled="true" debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

to the domain property file.

Questions are --

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 ?

Please help.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

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.
I agree. Here's the link:
subject: remote debug from myeclipse
It's not a secret anymore!