/ DEVELOPMENT,ECLISPE Tomcat/Eclipse : Remote debug

Tomcat/Eclipse : Remote debug


In this article, I will describe the “remote debug” on a server and its use in the IDE like Eclipse. This action could be useful in debugging case linked to the environment problematic cases.

Tomcat Server Configuration
First, it is necessary to configure the application server.

Stop the application server (in our case Tomcat):

  • In Unix: /etc/init.d/tomcat stop
  • In Windows: D:\Apache Software Foundation\Tomcat 7.0\bin\shutdown.bat or in the Server/Services manager

Modify the Catalina configuration in order to add the debug options
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n:

  • In Unix: to the CATALINA_OPTS variable in
  • In Windows: in the Java Options in the Tomcat properties

Modification of compilation options
Then, in order to debug an appplication, it’s necessary to compile its sources with the debugging options:
debug=”on” debuglevel=”lines,vars,source”

For example, in an ANT build xml file, it’s necessary to modify the line concerning the compilation javac like:

<javac srcdir="src/main/java" encoding="UTF-8" destdir="${CLASSES_PATH}" debug="on" debuglevel="lines,vars,source" verbose="false">
<classpath refid="compilationClasspath"/>

Generate the WAR, deploy it on the application server and restart the server:

  • In Unix: /opt/tomcat/bin/
  • In Windows: D:\Apache Software Foundation\Tomcat 7.0\bin\start.bat or in the Server/Services manager

Eclipse Configuration
Finally, in IDE (Eclipse in our example), go in the menu : Run / Debug Configurations…

In the opened window “Debug configurations”, do a right-clic on Remote Java Application, and New:

Select the concerning sources projects:

Fill in the application server parameters corresponding to the values filled in the Catalina configuration:
Host :
Port : 8000

…and launch the debug session by clicking on Debug button:remote-debug-129

…so, we could debug our application like deployed on a local server with breakpoints:
remote-debug-129 2

The console and standard output is done on the remote server, not in Eclipse view:
remote-debug-130 2


The standard output will be visible in:

  • In Unix: tail -f /opt/tomcat/logs/Catalina.out
  • In Windows: D:\Apache Software Foundation\Tomcat 7.0\logs\tomcat7-stdout-2014-02-10.log


That’s all!!!


Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Related Post