• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

remote debug from myeclipse

 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic