Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts

Thursday, June 03, 2010

The BASEDIR environment variable is not defined correctly

Solution: in the bin directory, chmod +x *

Friday, July 10, 2009

Tomcat error:: Only a type can be imported. resolves to a package

If you see the following
Only a type can be imported. XYZ resolves to a package.

when you try to import a class into your JSP, the reason is the following:

the class is not available anywhere - either in the WEB-INF/lib or (or server/lib or lib of your tomcat instance).

Thursday, April 03, 2008

Tomcat shutdown.sh shuts down all tomcat instances

If you are running tomcat instances on multi-homed machines, then by default, the shut down scripts will kill all tomcat instances on the box. What you need to do is change the shutdown port in conf/server.xml


<Server port="8011" shutdown="SHUTDOWN">


The default port that is present here is 8005.

Wednesday, April 02, 2008

How To: Debug Web Applications on Tomcat with JPDA

Suppose you want to debug a servlet in eclipse.

WINDOWS:-

Step 1: Change your catalina.bat with the following changes


if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_socket
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=8787


Step 2: Start Tomcat with

catalina start jpda


Step 3: Open your debug dialog in Eclipse. Add a remote java application with port "8787".

UNIX/LINUX:
No change really needed.

$>./catalina.sh jpda start
$>./catalina.sh jpda stop

Eclipse needs to have a remote java application with port "8000"

Where is Tomcat endorsed directory?

If you are haunted by this question, then for Tomcat 5.x, the folder is tomcat/common/endorsed. For Tomcat 6.x, create a endorsed directory under tomcat. tomcat is basically where the CATALINA_HOME is pointing to.

Under endorsed dir, you should have the following jars (and any other jars needed):

asaldhana~/apache-tomcat-6.0.16/endorsed>ls
resolver.jar serializer.jar xalan.jar xercesImpl.jar xml-apis.jar

Monday, April 17, 2006

mod_jk versus mod_proxy

Before we proceed, please have a look at mod_cluster.

Now to mod_jk versus mod_proxy comparison:

A good blog post by Mladen Turk "Comparing mod_proxy and mod_jk".

Interesting reply from Bill Barker, one of the developers on mod_jk.
mod_jk versus mod_proxy under load ?

The moral of the links above is that due to persistent connections, mod_jk has better performance than mod_proxy. But the flip side is that mod_jk has extra configuration to set up, in comparison to mod_proxy.

From official documentation from Tomcat at: Tomcat Connectors, you can get the following snippet:

- "mod_jk" is great and should be used for production. It is getting fixes as needed (which is now rare).
- "mod_proxy". A cheap way to proxy without the hassles of configuring JK. This solution lacks sticky session load balancing. If you don't need some of the features of jk, jk2 - this is a very simple alternative.
- "mod_proxy_ajp". With apache 2.2, mod_proxy was rewritten to support load balancing as well as a new transport called mod_proxy_ajp. This module is distributed with the Apache http server, not the Tomcat server.


Interesting note from a sys admin (from his Feb 15, 2006 post):

Goodbye mod_jk hello mod_proxy


Another good article on the usage of Apache as a Forward or a reverse proxy using mod_proxy:
Forward and Reverse Proxies

Here is a blog on load balancing with mod_proxy:
LoadBalancingWithModProxy


....