Can't Remotely Debug Tomcat Running on CentOS Virtual Machine from Eclipse on Host Windows 7
Setup
VMWare Virtual Machine
- CentOS 5.5 64-bit
- OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
- Tomcat 6.0
Host Machine
- Windows 7 64-bit
- Oracle/Sun JDK 1.6 64-bit 开发者_开发技巧
- Eclipse Helios for Java EE developers
Problem
My eclipse Remote Java Application has following connection properties:
Host: 192.168.94.133
Port: 8000
When I run the above configuration, I get:
Failed to connect to remote VM. Connection refused.
Connection refused: connect
Nothing new comes out of tomcat's log.
But when I telnet from the windows box:
bash-3.2$ telnet 192.168.94.133 8000
Trying 192.168.94.133...
Connected to 192.168.94.133.
Escape character is '^]'.
Connection closed by foreign host.
Every time I try the above telnet, tomcat spits this out in the log:
Debugger failed to attach: timeout during handshake
Because of the telnet behavior, I think the issue is in Eclipse... I'd appreciate any help.
Thanks,
-DaveYou are probably trying to connect twice to port 8000 from Eclipse (without noticing).
Switch to the Debug Perspective explicitly ("Window - Open Perspective - Debug") and see if you are connected.
Settings required in Tomcat 1)Create setenv.sh file under */tomcat/bin/. The location will be same as the catalina.sh file
2)Place the below content inside it. export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
Now start the Tomcat server. Once it is started please proceed with the below steps.
Settings required in Eclipse
3)In Eclipse go to Windows-->Preference--> General-->Network Connection --> Active Provider should be Direct. After changing to direct restart the eclipse.
4)In eclipse right click on project and debug as ->debug configuration ->Remote java application ->Create new configuration. Fill the below fields Name: as your wish Project:Select the project which you need to debug. ConnectionType: Standard socket attach Host: Localhost Port: 8000(It should be same as mentioned in point 2) Then click debug.
The debug will start at port 8000. Now you can verify by keeping breakpoints.
精彩评论