Kill Tomcat service running on Windows

October 25, 2018

If you terminate a running Spring boot application from within the eclipse, at times the port on which embedded tomcat listens does not free up. I found the below commands on one of the StackOverflow posts which are really handy.

C:\yourdir>netstat -aon |find /i “listening” |find “8080”


Now grab the PID (68 in this case) and run the below command to kill it.

C:\yourdir>taskkill /F /PID 68

Debugging Web-application deployed on Tomcat using Eclipse

January 15, 2010

This small article will walk you through the steps needed to setup the Eclipse environment for debugging Web application deployed on Tomcat server. I have used Tomcat 6.0.18 and Eclipse Ganymede for this purpose.

  1. Add the following lines in {tomcat.home}/bin/catalina.bat. tomcat.home is your tomcat installation directory.
  2. set JPDA_ADDRESS=1044
    set JPDA_TRANSPORT=dt_socket
  3. Open Eclipse “Debug Configurations” window. Menu Navigation – Run > Debug Configurations…
  4. Add new “Remote Java Application” as below
  5. The “Port” should match to the JPDA_ADDRESS configured above in step #1.
  6. Click “Debug” to start debugging.
  7. Start the Tomcat server using command “catalina jpda run”. This starts Tomcat in debugging mode.
  8. If the “Breakpoint” is encountered while application is being executed, Eclipse will ask you if you want to switch to Debug perspective where you can debug the application using standard debug controls.
  9. There is one nice article on IBM developer works that explains Debugging. Here is one helpful resource to know more about debugging techniques IBM RAD Tutorial .

Hope this helps in setting up a Eclipse Debugger for debugging your applications.  Do let me know if you feel this article needs improvements and your suggestions.

Cheers !


Setting Connection Pool in Tomcat 6.x

December 7, 2009


Recently I was configuring a connection pool for Oracle database on Tomcat server. Hence thought of sharing the same with you all.  I am sure that everyone out there must have done this and found it simple. The reason for posting this is that most of my colleagues missed putting the driver JAR file in the server lib directory which is needed by tomcat to refer the driver classes at the start-up.

  1. Make sure you have the JDBC Drivers placed in the {tomcat.home}/lib directory. For Oracle 10g use ojdbc14_g.jar
  2. Create a file named context.xml in <<yourwebapp>>\WebContent\META-INF directory.
  3. Use Resource element to configure the connection pool as shown below.
  4. Sample context.xml file

    <?xml version="1.0" encoding="UTF-8"?>
    <Context antiResourceLocking="false" privileged="true" cookies="true">
    <Resource name="jdbc/mypool" auth="Container"
    username=<<username goes here>>
    password=<<password goes here>>
    maxActive="20" maxIdle="10" maxWait="-1"/>
  5. Add the resource reference to the DataSource created in Step#3 to the web-application using web.xml.
  6. Refer the DataSource using “<res-ref-name>” as the JNDI name in your source.
  7. E.g.

    <description>DataSource for Web Application</description>

Hope this helps you setting up the connection pool.

Note: Resource element used to configure the connection pool has lot of configurable properties. Only base minimum properties are used above. For further information on DBCP configuration you can refer DBCP Configuration Parameters