Tomcat Remote Debugging Eclipse

  • Tomcat remote debugging eclipse. Remote debugging Tomcat with Eclipse, Configuring Tomcat as a Known Server from within Eclipse Open the 'Debug' view. Open the 'Servers' tab. Using the right mouse button (or Tomcat Remote Debugging Eclipse 1. Start Tomcat In Remote Debug Mode. Debug Java Web Application From Eclipse.
  • To check out how remote debugging works, you can use the Apache Tomcat 8 web server. Any other web or enterprise Java server can be set up for debugging with the same parameters, although they may be configured in different ways.

In this tutorial we will see how to debug remotely java code which can be executing in a server which is not the machine in which we are executing Eclipse. We will see the process of debugging in eclipse and Tomcat server, with more detail. We will also see some concepts on development environment in companies.

Remote Debugging of Tomcat with Eclipse 4) Execute the debug. We have to click on the button “Debug” and Eclipse will connect with Tomcat (it had to be previously running as I mentioned in this post). Now we have to put the breakpoints inside the Eclipse project to debug as we do with a.

Workstation and Host.

Workstation is the machine where the developer works and where eclipse is installed. A Host or Server is a machine where all the server applications are installed, as well as the SQL database servers, Web servers, etc. Normally, a developer works in his Workstation and when he has a stable version, he publish it(makes a deployment) in the Host, so that the clients, application users or testing teams, can see it.

Development environment, integration, pre-production and production.

The development environment is the sum of the hardware and software used by the developer to program. It can be composed by only the Workstation or it can include one or more Host servers. Sometimes, instead of using a Web server in our Workstation, we use a server to publish the application.

When the application is finished we install it, in one or more servers or Hosts, which are known as production environment. This installation will be the one used by the web application final users.

In big companies, there are intermediate environments known as integration, pre-production or testing, used to test the application before it goes to the environment production.

When is the remote debugging interesting?


When an application is installed on an integration or production server, it is normal that it communicates with other applications (Example.: SQL servers, web services, etc.). A lot of times this interaction can only be tested in the server. A lot of times the workstations use Windows and Linux servers.

Remote Debugging Visual Studio

Eclipse remote debug tomcat

Due to this, a lot of times we only find errors in our application when it is installed in the server, and not before in our Workstations, where it works correctly. Other times, it is not even possible to test certain funcionalities in the Workstation. In these cases, to be able to debug the application in the server, is very helpful.

FrostWire 4.21.8. FrostWire - (Open Source) Download this version 8.9 MB. Description; Technical; Change Log; FrostWire is a free software alternative for sharing file over the Internet, allowing to download large files. FrostWire is a P2P client application for sharing files over the Gnutella network. With a simple and nice interface, user. Frostwire 4.21 8. FrostWire 4.21.8 Change Log. Fixes a possible freeze reported by some users when the configuration wizard is shown. Fixes issue when a user changes default Gnutella Save Folder and unchecks Sharing finished downloads. Individually shared files from the old Save Folder would still be shared. Now all individually shared files will be unshared.

How does the remote debugging work?

The java virtual machine can do this remote debugging. This facility is not limited to Tomcat and can be use with any program written in java.

The following graphic shows us a web application called app1, deployed on Tomcat, installed in a Host and debugged on an eclipse installed in a Workstation.

In Eclipse we find the source code of the application 'app1', with the breakpoints where we want the debugger to stop. The JVM communicates with Eclipse using the tcp/ip protocol.

To start this diagram, we start Tomcat for the remote debugging indicating a tcp/ip port (for example:8000), where it will stay waiting till it connects with Eclipse. In Eclipse we start a remote debugging indicating the Host ip address and the indicated port (for example.:8000).

Remote Debugging Of Tomcat Using Eclipse

Debugging our example 'first-jee'

The first thing we are going to do is to generate the file first-jee.war and copy it in the webapps directory of Tomcat (Right button of the mouse on the project - Export - WAR file ..). Once we have copied it, we need to start Tomcat in remote debugging.

Tomcat Remote Debugging Eclipse Software

The Servlet containers like Tomcat are java applications. If you remember from the last tutorials, we started the Tomcat with start.bat. When we executed start.bat, this executed setclasspath.bat and finally catalina.bat, which executed something like:

java -classpath 'C:apache-tomcat-6.0.33binbootstrap.jar' org.apache.catalina.startup.Bootstrap

This instruction tells the JVM to execute the static main method of the class 'Bootstrap', which is inside the file bootstrap.jar. The main method will start the server which will be waiting http requests in the 8080 port (by default).

We can inform the JVM that we want him to start in the remote debugging mode, including these options -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y

Eclipse Add Tomcat

java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y -classpath 'C:apache-tomcat-6.0.33binbootstrap.jar' org.apache.catalina.startup.Bootstrap

Eclipse Remote Debugging

As we have indicated with 'suspend=y', the JVM stays waiting for the connection of the debugger in the port 8080. To establish the connection in Eclipe we go to menú Run - Debug Configuration - Remote Java Application -new

In 'Project' we indicate the project which contains the source code of the application which we are going to debug. In 'Host' we indicate the ip address of the Host where the server is (in this example I´m using the same machine so I will use localhost), in 'port' we write the choosen port when we start the JVM (in our case 8000), and lastly we click on Debug.

If we go to the debug perspective we will see the call stack which indicates [localhost:8000]

We check if we still have the breakpoint in, we open a browser in localhost:8080/first-jee/login-servlet.html and we click the button. In the debug perspective, we can see the execution interrupt in the same way as in the last tutorial.


Tomcat Remote Debugging Eclipse Version

It is important to highlight:

  1. The servlets containers (like Tomcat), are java applications which execute over a JVM.
  2. The debugging capacity is inherent to the JVM. We can debug remotely any java application.
<< Web application debugging Index >>