1

The problem:

Debugging a java web application deployed in Tomcat 7 is not working. Eclipse seems to connect to Tomcat but breakpoints are ignored when I try to debug. I did the following:

First of all I have also tried: Remote debugging Tomcat with Eclipse.

  1. started Tomcat7 in debug mode with :

    set JPDA_OPTS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
    catalina.bat jpda start
    
  2. Debug as - > Remote Java Application with host : localhost and port : 8000.

  3. Created a few breakpoints on a servlet where the request should suspend and let me debug but it's like there is no breakpoint set.

Thank you all,
Daniel

P.S. This is my first question so please be kind .

Community
  • 1
  • 1
Daniel
  • 13
  • 1
  • 4

1 Answers1

3

One possible explanation is that the class files in your WAR file (deployed on Tomcat) do not contain line numbers.

If you told us with which compiler and compiler plugin (Oracle javac, Eclipse, ANT, Maven, etc.) the class files were produced and what settings were used we may be able to provide further details.

Update

Author says in comment that ANT is used to compile. Follow-up:

The ANT javac task is just a wrapper around a concrete compiler. So, the options you can set depend on the actual javac. However, what you're looking for is debug="true" debuglevel="lines". ANT will then pass -g:lines to javac (see docs).

Sidenote: optimize="true" is ignored (check the docs).

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
  • I am using Eclipse Juno with default Ant Plugin . I've write my build.xml and run my tasks from Ant perspective. The actual build(compile) is done with : – Daniel Dec 27 '13 at 17:15
  • Thank you @Marcel for your help. Your answer helped me solve my problem with break points and making sure that java and javac use the same java version helped me solve my new discovered problem( I could not see local variables values when debugging). Have a good new year. – Daniel Dec 30 '13 at 08:59