- Tomcat 6.0.18
- Eclipse 3.4
- Windows XP
Tomcat Configuration
- Go to CATALINA_HOME\bin and edit catalina.bat in any editor, say Notepad++ . Here CATALINA_HOME is your tomcat installation directory. For me it is C:\Tomcat6.0 .
- Find JPDA_TRANSPORT and set it as JPDA_TRANSPORT=dt_socket .
- Find JPDA_ADDRESS and set it as JPDA_ADDRESS=8000 (you can use any unused port).
- Check if port specified is not being already being used; by executing "netstat" at command prompt. Check list of local ports.
- Save your changes.
- Start your server in debug mode by hitting "catalina jpda start". You may like to add CATALINA_HOME\bin in you PATH environment variable.
- Click on green beetle -> debug configurations...
- At Remote Java Application, click new and configure the settings.
- Give a name to this debug configuration (homebase-tomcat for me).
- Type localhost at Host or any name you have given to you localhost, mapped to 127.0.0.1 in hosts file (localhost.mlbam.com for me).
- Type 8000 as the port. Please note that the port must be the same with the JPDA_ADDRESS in catalina.bat file.
- Browse the project that you would like to debug.
- Click on debug button.
Debugging
- Go to your code and put breakpoints by double clicking on the left panel, wherever you want to debug.
- Hit your server by opening pages, where you want to debug, in browser.
- You will see eclipse switches to debug perspective and debug control flow stops at first breakpoint on the way.
- Use following eclipse shortcuts to proceed debugging
- F5 - Step into (you may like to go inside any method on the way)
- F6 - Step over (line by line)
- F7 - Step return (coming out back after going down into a call hierarchy)
- F8 - Resume debugging (breakpoint to breakpoint)
- Use terminate and disconnect buttons to stop debugging
No comments:
Post a Comment