Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging a tomcat project in Eclipse 3.4.2

I downloaded eclipse 3.4.2 and tried installing tomcat plugin (version 3.2.1)for eclipse from sysdeo (http://www.eclipsetotale.com/tomcatPlugin.html)

I have followed installation instructions but when is start tomcat from eclipse toolbar i got the following error

java.lang.NoClassDefFoundError: org/apache/tomcat/util/log/SystemLogHandler at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357) at java.lang.Class.getConstructor0(Class.java:2671) at java.lang.Class.newInstance0(Class.java:321) at java.lang.Class.newInstance(Class.java:303) at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:205) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:390)

I did follow troubleshoot instructions but no success.

I tried to putting plugin in dropin directory too but still got the same error.

This was working fine in eclipse 3.2 and 3.3

Then I tried using standard inbuilt WTP to set up my tomcat server. I am not sure how it will pick my server.xml in conf directory of tomcat, it seems it is not picking as of now. How do I associate my eclipse project with this setup. I am able to start the server but when i browse the tomcat start page, it does not show anything.

I would appreciate if someone can provide some ways to fix this.

Thanks in advance.

-Dipesh

like image 602
Dipesh Avatar asked Mar 19 '09 19:03

Dipesh


People also ask

How do I debug Apache Tomcat?

If you have Tomcat running as a windows service, then configuring Tomcat to start up with ability to be debugged remotely is done by simply specifying the start up arguments in the run properties. With this added to the options, starting the Tomcat service would have remote debugging enabled.

What is the debug port for Tomcat?

By default tomcat running port is 8080. So for the debugger, I will allocate port 8081. For that, you can select any port except tomcat running port or any other allocated ports in your localhost for other running servers.


2 Answers

After trying out few things I was able to debug tomcat project in eclipse 3.4.2 To debug tomcat application/project using eclipse 3.4.2 use WTP plugins which are installed along with it.

Go to Window --> Show View --> Others --> Server

In this view create a new server, please select tomcat installation directory and version information.

Then double click on Tomcat VX.X Server at local host, it opens up configuration settings page

In the Server Locations Section select "Use Tomcat Installation (takes control of Tomcat Installation) and enter deploy path.

In the publishing section select Never Publish automatically and uncheck update context path checkbox.

Voila!! All set to debug tomcat project in eclipse 3.4.2

There is no need to download and copy any extra plugin.

Thanks Juri. Hope this helps.

like image 141
Dipesh Avatar answered Sep 21 '22 21:09

Dipesh


I'm using Tomcat with Eclipse Java EE version with WTP and it works perfectly. I have Ant scripts which deploy my web app to the tomcat webapp folder. In order to debug, you have to open the Server view in Eclipse, add a new server and choose the correct Tomcat version. Once that's done, open the configuration of Tomcat within eclipse by double-clicking on the server entry in the Eclipse server view you just created. On the left-middle side of the confguration page you should see something like "let Eclipse control the native Tomcat installation", I don't remember the exact text now. You have to choose that. Then you can set a breakpoint in your source code and then start Tomcat in debug mode from within Eclipse's server view. Hope that helped.

like image 27
Juri Avatar answered Sep 25 '22 21:09

Juri