Using eclipse to debug your tomcat web application
Got this question again today. Usually i’d say: use the tomcat plugin, but in this case tomcat 3.2.4 is used, as that’s the tomcat version the web server is still using. The eclipse tomcat plugin only supports tomcat 3.3 and up.
Here’s what you do:
- Start java with remote debugging enabled. You do this by modifying tomcat.bat (assuming you’re on windows). You have to add some parameters when starting java. If you start tomcat from a cmd box, look for the line “echo Starting Tomcat in new window” in tomcat.bat. Add the following line:
set JAVA_X_OPTS=-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000
And modify the star t java line as follows:
_STARTJAVA TOMCAT_OPTS -Dtomcat.home="TOMCAT_HOME"
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %
Now you can start tomcat by typing startup.bat in your cmd box.
- Click on the debug button in your eclipse toolbar. Select the “Debug…” item. This will open a debug window. Under configurations you’ll find an entry “Remote Java Application”. Select this and then press the new button. Choose a project, leave the connection type to “standard (socket attach)” and for connection properties choose “localhost” and “5000” (change these if you’re using a different port or a different machine to run tomcat). Now press apply and debug.
That’s it. You can now set breakpoints in your code, and inspect what your application is doing.
23 Oct 2003 |
October 23rd, 2003 at 2:20 pm
Works like a charm, I’m using this myself.
But can’t the sysdeo plugin debug the 3.x Tomcat versions?
October 23rd, 2003 at 2:41 pm
Only 3.3, not 3.2. I got a class not found error when trying to debug 3.2.
October 23rd, 2003 at 2:54 pm
How about JSP? Can we do it this way?
October 23rd, 2003 at 4:04 pm
Thanks, for the tip
October 29th, 2003 at 8:50 pm
You cannot debug jsp’s using this technique. You may be able to debug the java files generated for the jsp files, but probably only if the directory your tomcat application context is pointing to, is the directory where you develop your application (i.e., not if you are deploying a war file). But i’ve never tried this, so it may not work.
April 14th, 2004 at 11:28 am
hi,
i am using tomcat 5.0.16 final. what is the best way to debug my web application? including the jsp and the bean classes? an early answer will be appreciated.
thanx.
April 14th, 2004 at 11:39 am
Take a look at the lomboz plugin for eclipse. It supports jsp debugging. Matt raible has packaged it for eclipse 3.0 M8, with some other usefull plugins: http://raibledesigns.com/page/rd?anchor=eclipse_plugins_updated_for_3
July 13th, 2004 at 11:54 am
Hi, I want to know how to debug a Jsp from eclispe 3.0 or eclipse 2.1.3 on Jboss-3.2.4
July 13th, 2004 at 12:13 pm
As mentioned in the previous comment, you can use matt raible’s plugin, or you can use myeclipse (http://www.myeclipseide.com/). The sysdeo tomcat plugin (http://www.sysdeo.com/eclipse/tomcatPlugin.html) also supports jsp debugging (not very user friendly, but it seems to work).
July 13th, 2004 at 4:13 pm
Thanks for your prompt reply but i am using jboss 3.2.4.
In jboss 3.2.4,tomcat 5 is integrated.So there is a problem in setting up the configuartion for sysdeo tomcat plugin like setting tomcat home and server.xml.Just i want a plugin or anything that will provide good debugging facility for java classes,struts and jsps.And iam very thankfult to you,if you give any example for debugging also.As i am beginner to eclipse and other plugins.Please give me detailed step by step procedure.
Thanking you.
mahesh
July 14th, 2004 at 5:58 am
Hi Andrej,can you give quick reply to previous comment.
mahesh
July 14th, 2004 at 8:19 am
I have no experience with the exact versions you mention. Have you looked at myeclipse? Another option is to download jdeveloper from OTN (http://otn.oracle.com/). Jdeveloper has good jsp debugging support.
July 14th, 2004 at 8:41 am
Hi Andrej,once again thanks for your reply.From eclipse i am building my web application archive(exploded war) file through my bulid.xml.I also integrated jboss-3.2.4 into my eclipse 3.0.Then i am starting jboss server in debug mode.
But i have no idea how to trace java classes and jsp in running web module.
And one more thing is how to integrate struts plugin into eclipse 3.0.I tried to install easystruts plugin but its asking for org.eclipse.pde.ui.But where as in my eclipse plugin directory org.eclipse.pde.ui_3.00 is there.
I hope now you clearly understood my problem.
Thanking you.
mahesh
August 14th, 2004 at 12:52 pm
Well, I hv one problem below in deploying application on tomcat. pls.. do needful for me.
I m getting The requested resource (/Assignment/Assign/welcome.jsp) is not available. error.
I am trying simple example to know how MVC work. I m using Eclipse 2.1 IDE n Tomcat 5.0.
I hv configured Tomcat, set all paths i.e. JAVA_HOME, JRE_HOME, CLASSPATH, CATALINA_HOME, all things set in Eclipse prefeference. My web application folder name is Assignment in which i hv one directory Assign. On the root of directory i hv all xml including web.xml. I hv written welcome.jsp on root n my web.xml contains
(here frame work is webwork.)
all jars are included on web server and WEB-INF/lib folder. Action class is in Assign folder.
All things r well set. Tomcat is running. I m requesting http://localhost:8080/Assignment/Assign/welcome.jsp it gives me welcome.jsp not found error and following exception in tomcat javax.management.MalformedObjectNameException,
BindingException.
Another thing i want to know textfields, combo values are mapped to action class fields.
Thanks & Regards,
Rajendra
August 23rd, 2004 at 7:56 pm
I am running pretty vanilla Tomcat 5 fine standalone. I have SYSDEO plugin in Eclipse and can start and stop Tomcat. I get “Failed to connect to remote VM” when I try to run debug. None of the text above appears in the Catalina bats and xmls. I really would appreciate the dummies version.
September 1st, 2004 at 7:49 pm
The progress bar hangs on 91%
I have Tomcat 4.1.30 Service on the same machine
Eclipse 3.0
Windows XP Home SP1
June 21st, 2005 at 4:11 pm
Sir, can u tell me the prodedure for running tomcat in eclipse. I am using Tomcat 5.0 and Eclipse 3.0 i installed Sysdeo Plugins for tomcat but how to run tomcat within eclipse. Please help me to solve the above query. Please give prodedure.
Awaiting for your reply.
Thanx
August 16th, 2005 at 2:57 pm
Sir,
i have Win’98 in my pc.i want to work on j2ee.so i need jboss-3.2.4 or oc4j and a editor and i prefer eclipse.can u suggest me a site whr i can download all these free of cost
Thanking u
August 16th, 2005 at 3:17 pm
Try google, all of these tools are available for download. It shouldn’t be hard to find the sites where you can download them.
September 17th, 2005 at 8:01 am
I am using tomcat 4.1 and there is no tomcat.bat in bin folder
can u plz tell me the procedure for starting tomcat 4.1 in debugging mode
October 10th, 2005 at 2:08 pm
Hi,
I am also facing the above mentioned problem. In tomcat 4.1, there is no tomcat.bat file in the folder bin. So, what to do to start the Server from DOS prompt? Can anybody give a prompt reply?
November 13th, 2005 at 9:41 am
about debuging JSP with tomcatPlugin:
in your tomcat project, find the directory named “work”, and you can find the servelet corresponding to the JSP there. debug the servlets.
December 17th, 2005 at 12:38 pm
how can run one folder that contains all jsp’s and servlets,
with tomcat5.x and eclipse3.1 ide tool.
January 30th, 2006 at 10:06 am
Hello,
I want to debugg jsps and beans using eclips.using ur website
I found that there are 3 ways to that.
1)Resin plugin
2)MyEclipse plugin
3)sysdeo plugin
can u plase tell me the differences amoung them and which is better plugin
February 15th, 2006 at 4:53 pm
Hi !
I have eclipse-sysdeo question.
I have tomcat project with SysDeo plug-in in eclipse 3.1.1
I was able to set breakpoint in servlet code ( struts Action), I refactored name of eclipse project to diffrent name
Now I can’t see execution step in Debug view.
Do you know what I have to set to see step debugging ?
Thanks.
Digant
March 15th, 2006 at 7:45 pm
I am trying to accomplish remote debugging of a Java application using Eclipse 3.1 and Tomcat 5.5 on Windows platforms. I have made all the suggested modifications to Catalina.bat file and ran the bat file on the server containing the war file using Port 8000. On launching the application from Eclipse I get the message “Failed to connect to remote VM”. The network web server is located behind an F5 and port forwarding is enabled and I believe this is my problem. Does anybody have any information relative to remote debugging a java application on an F5 network using port forwarding? Thanks for any help
March 23rd, 2006 at 7:18 pm
I’ve used tomcat and I’ve never really had this problem.
April 27th, 2006 at 8:19 am
Hi Andrej ,
With ur permission.. I am adding this link, provide the info for
debugging with eclipse.
http://jroller.com/page/gursesl/cleanfulltext/remote_application_debugging_with_weblogic#eclipse
May 1st, 2006 at 12:46 pm
I wish to do remote debugging of a Tomcat 3.3 (and Java 1.3) application via eclipse 3.1.2
Constraints of the project force me to use an older version of Tomcat. I already know that it is not possible to set up Tomcat 3 as a server project within eclipse. How do I fill in the Run/Debug/Remote Application configuration? I’ve tried with both Port 5000 and Port 8000 but I get a “Failed to Connect to VM message”
Thanks,
David
dziants@gmail.com
May 16th, 2006 at 6:37 am
I am getting the following in eclipse 3.0 console. What I mean that the “Debug output” is being redirected to the screen,
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:148) – servletPath=/jsp/login/ValidateLogin.jsp, pathInfo=null, queryString=null, name=null
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:564) – Path Based Include
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:148) – servletPath=/Delegate, pathInfo=null, queryString=ACTIONKEY=UserContextAction.setupProjectList&REDIRECTKEY=login/ProjectList, name=null
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:381) – Path Based Forward
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:148) – servletPath=/jsp/login/ProjectList.jsp, pathInfo=null, queryString=null, name=null
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:564) – Path Based Include
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:418) – Disabling the response for futher output
DEBUG [http-8080-Processor24] (ApplicationDispatcher.java:426) – The Response is vehiculed using a wrapper: org.apache.catalina.core.ApplicationHttpResponse
DEBUG [http-8080-Processor25] (ApplicationDispatcher.java:148) – servletPath=/jsp/MenuIndex.jsp, pathInfo=null, queryString=null, name=null
DEBUG [http-8080-Processor25] (ApplicationDispatcher.java:564) – Path Based Include
DEBUG [http-8080-Processor25] (ApplicationDispatcher.java:148) – servletPath=/jsp/MenuHeader.jsp, pathInfo=null, queryString=null, name=null
DEBUG [http-8080-Processor25] (ApplicationDispatcher.java:564) – Path Based Include
DEBUG [http-8080-Processor25] (ApplicationDispatcher.java:148) – servletPath=/jsp/dashboard/QuickSearch.jsp, pathInfo=null, queryString=null, name=null
DEBUG [http-8080-Processor25] (ApplicationDispatcher.java:564) – Path Based Include
Can anyone suggest how to stop the “Debug output” from being redirected to the console.
May 23rd, 2006 at 11:08 am
hi, i too have the similar kind of problem , i used tomcat plugin in eclipse and when i attempts to start tomcat its going to debug mode how to solve this
June 28th, 2006 at 10:00 am
now i want to find how to debug using tomcat5.5 apllication by using eclips3.2
July 7th, 2006 at 10:29 pm
does anyone know how to register tomcat 5.5 with eclipse 3.2
i do not have options for tomcat…
thanks
July 14th, 2006 at 9:42 am
send detail procedure for debugging and how to process break points
July 18th, 2006 at 8:49 pm
Digant said:
>I have tomcat project with SysDeo plug-in in eclipse 3.1.1
>I was able to set breakpoint in servlet code ( struts Action)
>Now I can’t see execution step in Debug view.
I’m experiencing a similar error. I can see the progress of the program in the debug window, but Eclipse does not synchronize the code window nor highlight the currently executing line. Has anyone experienced anything similar?
July 18th, 2006 at 9:00 pm
A solution: in the Tomcat add-in settings, click “Source Path.” Uncheck “Automatically Compute Source Path”, and check the projects you wish to debug.
Seems obvious in retrospect.
August 8th, 2006 at 7:47 am
I am using eclipse3.1
and I want to run struts applications using tomcat
I downloaded tomcatplugin but I am not able to find the tomcat icon on the eclipse editor
will you please help me
August 9th, 2006 at 4:21 pm
Thanks Jon!!!
I almost got crazy trying to fix that!!
Thanks for sharing that info!!
Regards
Santiago
Jon Says:
July 18th, 2006 at 9:00 pm
A solution: in the Tomcat add-in settings, click “Source Path.” Uncheck “Automatically Compute Source Path”, and check the projects you wish to debug.
Seems obvious in retrospect.
September 22nd, 2006 at 6:51 am
Hey
I am using tomcat but Eclipse tool will work only for one month and again we have to format.will u give the solution for this.But this tool is nice yaaaaaaaaar
December 21st, 2006 at 8:09 am
Hi,
how to view console of tomcat 5.5. I am using Logging (Log4j),
but i am not able to see console of tomcat 5.5
will u plz help me
ThanQ
December 28th, 2006 at 7:40 am
hi ihave no idea about eclipse3.1.2.how to run the sevelets programs in elipse.and how to add the plugins(server) in eclpise .i don’t reuired or not(add plugins in eclipse).
January 7th, 2007 at 8:23 am
HOW CAN I PLUG IN WITH ECLIPS FOR TOMCAT
January 20th, 2007 at 1:47 am
Jon thanks a lot !! It works.
Do everything that is suggested. ( Just start the tomcat using the buttons in eclipse)
create a new remote debugger as suggested above.
and in tomcat – source path: select the project folder which you want to debug. thats it !!
January 25th, 2007 at 10:15 pm
Hi Vinod/Anrej,
The remote debugging article has moved to
http://www.jacoozi.com/index.php?option=com_content&task=view&id=119&Itemid=134
Please update your bookmarks. Thanks.
February 7th, 2007 at 1:47 pm
In tomcat 5.0 tomcat.bat is renamed as catalina.bat.. and JAVA_X_OPTS is renamed to JAVA_OPTS
just update JAVA_OPTS as per the instructions and set the debug port 5000 in your eclipse (whatever version it is)
worked for mine..
Regards,
Tejas
March 15th, 2007 at 8:02 am
Hi,
Iam using Eclipse3.0.0 Tomcat 5.0. I deployed my project onto Tomcat. Now I want to launch the tomcat and debug using eclipse. I made the following changes to the catalina.bat
set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
and created a new configuration of Tomcat debugger. But eclipse throws an error saying unable to connect to VM.
April 10th, 2007 at 2:06 pm
Hi
I installed tomcat 6.0 i want to use struts any one suggest me on this topic. How to configure to run struts using tomcat
July 20th, 2007 at 2:12 pm
I m using eclipse 3.0 .
I m getting the problem .
Request is forwarded twice or thrice.
I have checked the code.
PLZ help me out.
July 30th, 2007 at 10:28 am
hi,
can anyone guide me how to use eclips? if u have related documents do fwd me. that ll def help me to understand abt Eclips.
looking for ur g8 favour….....
regards
MadhanKumar
September 14th, 2007 at 1:05 pm
hi ihave no idea about eclipse3.1.2.how to run the sevelets programs in elipse.and how to add the plugins(server) in eclpise .i don’t reuired or not(add plugins in eclipse).