I have a struts2 web application developed in eclipse IDE and exported it as war file and deployed it in tomcat7 installed in windows server. Now I need to debug this deployed web application in eclipse inside my local system. How to bring those codes inside? I found some links but I stuck with how to bring those code into eclipse in my local system to place break points.
these are those few links...

- 1
- 1

- 1,732
- 5
- 26
- 45
-
does your tomcat run on windows? – Ingemar Aug 07 '12 at 12:00
-
@ Ingemar it works and why yo got this doubt? – Sathish Kumar k k Aug 08 '12 at 03:51
2 Answers
..Or simply navigate to the bin folder and start your tomcat with the following command:
catalina jpda start
No need to make any changes with this approach. The defaults are the same as quoted by Ingemar: port 8000 and transport=dt_socket. Confirmed to work with tomcat 7 (.0.40 or newer to be precise). Then follow his instructions and setup a Remote Java Application debug configuration in Eclipse. Basically, just use the defaults - they match (at least in Juno and Kepler). You might want to check the Source tab or do this on demand while you debug.
... Or, in case you use maven, you might consider the tomcat7-maven-plugin plugin, which will completely keep you inside eclipse.
Happy debugging

- 146
- 1
- 5
Solution for windows:
First you have to modyfy your tomcat startup script (startup.bat):
Put this on top of the startup.bat
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
...
Then modyfy the following line (nearly at hte end of startup.bat):
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
to
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
Now you can start tomcat by executing startup.bat and tomcat opens the port 8000 for debuging.
Second step is to configure Eclipse:
Select Run > Debug Configurations ...
Create a new configuration by selecting 'Remote Java Application' with a right click.
Check that the right Project is selected.
And modyfy the Connection properties. (Note that the port has to be same (8000) as entered in startup.bat and not the port on which your struts app is running)
Finaly you have to click on Debug
Now you should be able to set breakpoints.

- 1,638
- 2
- 12
- 15
-
Just a small correction, I think instead of writing "call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%" you should write "call "%EXECUTABLE%" jpda run %CMD_LINE_ARGS%" – htulsiani Aug 07 '12 at 12:33
-
my file contains "call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%" and it works, but i don't know the difference between start and run – Ingemar Aug 07 '12 at 12:36
-
1Correct Ingemar..my mistake. Both options work, the only difference I see is that with start option it logs in the catalina.out and with run option it shows the logs on the console itself. – htulsiani Aug 07 '12 at 13:16
-
@ Ingemar I did every thing you said before posting this question. Actually, what I need is how to bring that remote app inside my local eclipse and debug it (i.e.,) the web application is inside the tomcat7 installed on windows server and my eclipse is inside my local system. so how to import that running web app to eclipse in my local system and debug it. Note: it should not copy that project to my local system. – Sathish Kumar k k Aug 08 '12 at 04:03
-
You do not need to import the deployed web application to debug. All you need is the source code for the web application imported in your eclipse environment as a project. – htulsiani Aug 08 '12 at 07:27
-
@htulsiani how to do that since in the server I deployed the war file and it while deployed tomcat unzip the war file and which was not in in eclipse acceptable folder hierarchy so while I import it to eclipse it shows **No projects are found to import**. – Sathish Kumar k k Aug 08 '12 at 09:48
-
I think you have already a project with the sources in it. Or how did you create the war file you have deployed? So you do not have to import the sources into eclipse, use the project which you have previously exported to war file and create a debug configuration. Here you have to specify the remote location e.g. _your-server_ and port 8000 – Ingemar Aug 08 '12 at 10:09
-
@Ingemar OK if I found a bug and if I'm supposed to fix it then where do I needed to fix it? – Sathish Kumar k k Aug 08 '12 at 11:17
-
You have to fix it in your source code, then rebuild the war and deploy it on tomcat. Now you can again establish a debug connection from eclipse step again through the code. – Ingemar Aug 08 '12 at 11:40
-
@Ingemar so I again need to create war file and replace it with old one on server then need to restart the server... sounds little pain full... – Sathish Kumar k k Aug 08 '12 at 12:11
-
Yes, but you asked for remote debuging. For normal development you should use a local installation of tomcat and Eclipse WebToolsPlatform which has a Tomcat-Integration. This allows hot code replacement. You can use [this](http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/junor) version of eclipse. It's a bundled version of eclipse together with web tools platform. – Ingemar Aug 08 '12 at 14:25
-
@Ingemar so finally I realize that thinks I do in local installation can not be performed while web app is at the remote server. hey I have one doubt. If my code has a line that which point to server's local directory some where to fetch any file like image or what ever there in server, will it work while I debug with code I my local system and doing remote debugging? – Sathish Kumar k k Aug 09 '12 at 05:11