Tomcat


Tags:

Cronolog provides a solution to the age-old problem of tomcat's catalina.out log file not rotating and growing so large that the server must be stopped to deal with it.

First, install cronolog, which can be downloaded from here.

the cronolog command works like this:

cronolog [OPTIONS] logfile-spec


Tags:

Using wget and the Tomcat manager, you can script remote tomcat deploys, undeploys, starts, stops, and status.

First, make sure the tomcat manager is installed and running. (see: Configuring the Tomcat Manager)

Status

Now, we can get the status of all deployed apps by running the following command:

wget http://<username>:<password>@<hostname>:<port>/manager/list -O - -q

for example:


Tags:

In Tomcat 5.5, the manager GUI comes packaged, but not configured. To configure:

cp tomcat5.5/server/webapps/manager/manager.xml tomcat5.5/conf/Catalina/localhost/

vi tomcat5.5/conf/tomcat-users.xml

add:

<role rolename="manager"/>
<user username="admin" password="test1234" roles="tomcat,manager"/>

restart Tomcat.

The manager GUI can now be seen at:

http://hostname:8080/manager/html

and you will be prompted for the username and password you provided in the tomcat-users.xml



Tags:

To improve performance (most of the time) for Tomcat (and most any other java application server), the server can be run with the Java option "-server", which optimizes performance at startup, and can increase start up time quite a bit in some instances, but typically increases performance under normal use.

This can be set anywhere that you set JVM options, but for Tomcat, I set these options in the tomcat user (tcsh) profile as such:

setenv CATALINA_OPTS "-server -Xms128m -Xmx128m -XX:NewSize=48m -verbose:gc"