Tag Archives: tomcat

How to run apache tomcat in debug mode (Ubuntu)?

In my previous blog post I have shown you how to install apache tomcat in Ubuntu. We can run apache tomcat in debug mode and debug our applications. First you should download and installed tomcat in your machine.

There are two ways to run apache tomcat in debug mode

I) Using jpda run

First you have to set jpda environmental variables. Please remember set this variable only one time. Don’t set this variable every time you are going to start the server. It will cause to an error.

export JPDA_ADDRESS=8000

export JPDA_TRANSPORT=dt_socket

Then run the tomcat server in debug mode using following command.

%TOMCAT_HOME%/bin/catalina.sh jpda start

or going to the bin of your tomcat folder in the terminal and run the following command

sudo catalina.sh jpda start

II)Using JAVA_OPTS

Same as the previous method you have to set one environmental variable . First go to the bin directory on your tomcat folder and run the following command. Don’t set this variable again and gain, only one time is enough.

export JAVA_OPTS=-Xdebug Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8080

 

Then you can run the server in debug mode using following command.

execute this command in the bin folder of the tomcat.

sudo sh catalina.sh  run

if you get the following output, you will run the server debug mode successfully.

debug

Advertisements

How to install apache tomcat in ubuntu?

00)Prerequisite

Make sure you have installed the java in your ubuntu machine and set the JAVA_HOME variable.

01) Download the binary zip file of the apache tomcat latest version. download the tar.gz file in the following link

https://tomcat.apache.org/download-60.cgi

02) Then uncompress  the zip file and move it to the directory you want

03) Set the CATALINA_HOME environmental variable

export CATALINA_HOME=/path/to/tomcat/installation 

 (#eg./opt/tomcat7 )

03)Start the tomcat server

There are two ways to start the tomcat server in Ubuntu

I)Via an environment variable

Set an environment variable CATALINA_HOME to the path of the directory into which you have installed Tomcat

 Execute the shell command

$CATALINA_HOME/bin/startup.sh

II) By modifying your current working directory

In this method you have to go to the bin of the tomcat folder by the terminal and run the startup.sh file

Execute the following shell commands

cd PathTOTheTomcatDirectory/bin

./startup.sh

After startup, the default web applications included with Tomcat will be available by browsing:

http://localhost:8080/

Further information about configuring and running Tomcat can be found in the documentation included here, as well as on the Tomcat web site: http://tomcat.apache.org/

04) Shut Down Tomcat

There are two techniques by which Tomcat can be stopped:

I)Via an environment variable

Set an environment variable CATALINA_HOME to the path of the directory into which you have installed Tomcat

 $CATALINA_HOME/bin/shutdown.sh

II)By modifying your current working directory

Execute the following shell commands

cd $CATALINA_HOME/bin

 ./shutdown.sh