1

I try to remote debug Tomcat web app which are running in linux i started the tomcat with:

JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8111,server=y,suspend=n"

in the catalina.sh:

...
...
...
      # -----------------------------------------------------------------------------

    # OS specific support.  $var _must_ be set to either true or false.
    cygwin=false
    darwin=false
    os400=false
    case "`uname`" in
    CYGWIN*) cygwin=true;;
    Darwin*) darwin=true;;
    OS400*) os400=true;;
    esac

    JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8111,server=y,suspend=n"

    # resolve links - $0 may be a softlink
    PRG="$0"

    while [ -h "$PRG" ]; do
      ls=`ls -ld "$PRG"`
      link=`expr "$ls" : '.*-> \(.*\)$'`
      if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
      else
        PRG=`dirname "$PRG"`/"$link"
      fi
    done
...
...
...

and then i start tomcat with :

Tomcat/bin > catalina.sh jpda start

when i do netstat -a | grep 8111 i get :

tcp        0      0 *:8111                      *:*                         LISTEN

In windows , im using eclipse Version: Mars.1 (4.5.1) i configured the remote debug enter image description here

pressed debug , and i see the connection established both in server and in windows eclipse like this :

enter image description here

and in Linux server when i do netstat -a | grep 8111 i see :

tcp        0      0  linux:8111             my.pc.ip.66:62285          ESTABLISHED

i set allot of break points in eclipse , the source are the same but no breakpoints are stooping ... is it a bug ?

user63898
  • 29,839
  • 85
  • 272
  • 514

1 Answers1

1

The last screenshot is a guarantee that you have connected to your Tomcat. In order to stop on any of your breakpoints you need to exercise the code that you have set a breakpoint in. Usually just using your app will do.

Eclipse sometimes cannot set a breakpoint for some reason. When it does set it successfully a small tick appears on a breakpoint signaling that it is active.

enter image description here

If a particular class did not load yet, or there are some other problems, the breakpoint will not have a tick and will be left inactive.

enter image description here

Ensure that your breakpoints are active. If not, make sure that your project configuration (the one you used to make debug launch config) matches the WAR deployed to Tomcat.

If that does not work, you might have a different compilation options used to build your app deployed to Tomcat, for instance without line numbers. Try setting a breakpoint on method rather than on instruction. If that works, add debug options to compilation step in your build, so that line numbers are also included. That will let you set breakpoints on lines.

Michał Grzejszczak
  • 2,599
  • 1
  • 23
  • 28
  • Thanks , in my tomcat it is without this "tick" , the code is the same in both sides . maybe there is some tomcat configuration i missed ?? also when the sources are not the same eclipse throw some error massage – user63898 Dec 15 '15 at 07:40
  • from my experience when the sources are not the same eclipse throw some error massage. and in this case no error has Thrown – user63898 Dec 15 '15 at 07:55
  • What happens when you pause some thread? Are you able to see the sources when clicking through its stack trace? – Michał Grzejszczak Dec 15 '15 at 12:02
  • i dont see any thing it like they are connected but without connection now i installed eclipse in the same linux server and i try to debug the tomcat from within the same server without any luck maybe its my eclipse version bug ? – user63898 Dec 15 '15 at 12:24
  • I have updated the answer with more possible problems. See the last paragraph. – Michał Grzejszczak Dec 15 '15 at 13:48
  • thanks, in my build the options are with line numbers this is how my ant javac target looks like: – user63898 Dec 15 '15 at 14:29