<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vincentkong.com &#187; Tomcat</title>
	<atom:link href="http://www.vincentkong.com/tag/tomcat/feed" rel="self" type="application/rss+xml" />
	<link>https://www.vincentkong.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 07 Jul 2010 00:32:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</title>
		<link>https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804</link>
		<comments>https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804#comments</comments>
		<pubDate>Wed, 05 Nov 2008 03:36:39 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.vincentkong.com/?p=224</guid>
		<description><![CDATA[Normally when I build a web application that connects to a MySQL database, I would place the mysql-connector-java-bin.jar file into the WEB-INF/lib of the web application. However, when I deployed the application on Tomcat 5.5 on Ubuntu 8.04 I got an exception: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver I couldn&#8217;t find the reason which caused the exception, so I [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10</a></li>
<li><a href='https://www.vincentkong.com/2007/05/mysql-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: MySQL for Ubuntu Quickstart Guide'>MySQL for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Normally when I build a web application that connects to a MySQL database, I would place the <code>mysql-connector-java-bin.jar</code> file into the <code>WEB-INF/lib</code> of the web application.</p>
<p>However, when I deployed the application on Tomcat 5.5 on Ubuntu 8.04 I got an exception: <code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver</code></p>
<p>I couldn&#8217;t find the reason which caused the exception, so I did a quick fix by placing the jar file into the Tomcat&#8217;s common lib directory.</p>
<p><code>$ cp mysql-connector-java-bin.jar /usr/share/java<br />
$ cd /usr/share/tomcat5.5/common/lib<br />
$ ln -s ../../../java/mysql-connector-java-bin.jar mysql-connector-java-bin.jar</code></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10</a></li>
<li><a href='https://www.vincentkong.com/2007/05/mysql-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: MySQL for Ubuntu Quickstart Guide'>MySQL for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with Ubuntu 7.10 and Tomcat 5.5</title>
		<link>https://www.vincentkong.com/2008/01/problems-with-ubuntu-710-and-tomcat-55</link>
		<comments>https://www.vincentkong.com/2008/01/problems-with-ubuntu-710-and-tomcat-55#comments</comments>
		<pubDate>Tue, 15 Jan 2008 02:51:32 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=18</guid>
		<description><![CDATA[Ubuntu 7.10 (Gutsy Gibbon) was released on Oct 18, 2007, and like most administrators I decided to take advantage of the release and upgraded my current system 7.04 (Feisty Fawn). Overall, the upgrade went well and I didn&#8217;t run into any trouble during the upgrade process. However, afterwards I found some side effect on the [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-704' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Ubuntu 7.10 (Gutsy Gibbon) was released on Oct 18, 2007, and like most administrators I decided to take advantage of the release and upgraded my current system 7.04 (Feisty Fawn). Overall, the upgrade went well and I didn&#8217;t run into any trouble during the upgrade process. However, afterwards I found some side effect on the my web applications running on Tomcat:</p>
<ol>
<li> Log4j was no longer logging anything into the log files.</li>
<li>I was getting the following exception in the catalina.log file when attempting to dynamically render an image with a java servlet.<br />
<code><br />
java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/libawt.so: Can't load IA 32-bit .so on a IA 32-bit platform<br />
at java.lang.ClassLoader$NativeLibrary.load(Native Method)<br />
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)<br />
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)<br />
at java.lang.Runtime.loadLibrary0(Runtime.java:822)<br />
at java.lang.System.loadLibrary(System.java:993)<br />
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)<br />
at java.security.AccessController.doPrivileged(Native Method)<br />
at java.awt.Toolkit.loadLibraries(Toolkit.java:1509)<br />
at java.awt.Toolkit.&lt;clinit&gt;(Toolkit.java:1530)<br />
at java.awt.Font.&lt;clinit&gt;(Font.java:141)<br />
....</code></li>
</ol>
<p>It turned out that the Java JVM was upgraded to 1.5.0_13-b05 which contained several bugs. Not knowing of anyway to downgrade my JVM to it&#8217;s preivous version, I decided to install Java 6 and use it as the JVM for Tomcat.</p>
<p>To install Java 6 for Ubuntu:<br />
<code>$ apt-get install sun-java6-jdk</code></p>
<p>To configuring Tomcat to run on the Java 6 JVM:<br />
<code>$ nano /etc/default/tomcat5.5</code></p>
<p>Uncomment or add the following line:<br />
<code>JAVA_HOME=/usr/lib/jvm/java-6-sun</code></p>
<p>Restart the Tomcat server:<br />
<code>$ /etc/init.d/tomcat5.5 restart</code></p>
<p>Afterwards, everything was running back to normal!</p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-704' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2008/01/problems-with-ubuntu-710-and-tomcat-55/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10</title>
		<link>https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710</link>
		<comments>https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710#comments</comments>
		<pubDate>Wed, 31 Oct 2007 01:15:28 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.vincentkong.com/?p=152</guid>
		<description><![CDATA[This is related to one of the web application deployed in Tomcat containing the Apache Common Loggings jar file inside the WEB-INF/lib directory. To fix this issue, place a copy of the commons-logging jar file inside the Tomcat&#8217;s common endorsed directory. $ cp commons-logging-1.1.jar /usr/share/java $ cd /usr/share/tomcat5.5/common/endorsed $ ln -s ../../../java/commons-logging-1.1.jar commons-logging-1.1.jar Related posts:Problem [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
<li><a href='https://www.vincentkong.com/2008/01/problems-with-ubuntu-710-and-tomcat-55' rel='bookmark' title='Permanent Link: Problems with Ubuntu 7.10 and Tomcat 5.5'>Problems with Ubuntu 7.10 and Tomcat 5.5</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-704' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is related to one of the web application deployed in Tomcat containing the<br />
Apache Common Loggings jar file inside the WEB-INF/lib directory. To<br />
fix this issue, place a copy of the commons-logging jar file inside the<br />
Tomcat&#8217;s common endorsed directory.</p>
<pre>$ cp commons-logging-1.1.jar /usr/share/java
$ cd /usr/share/tomcat5.5/common/endorsed
$ ln -s ../../../java/commons-logging-1.1.jar commons-logging-1.1.jar</pre>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
<li><a href='https://www.vincentkong.com/2008/01/problems-with-ubuntu-710-and-tomcat-55' rel='bookmark' title='Permanent Link: Problems with Ubuntu 7.10 and Tomcat 5.5'>Problems with Ubuntu 7.10 and Tomcat 5.5</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-704' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.04</title>
		<link>https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-704</link>
		<comments>https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-704#comments</comments>
		<pubDate>Tue, 30 Oct 2007 16:11:32 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=102</guid>
		<description><![CDATA[For the Ubuntu installation, Tomcat&#8217;s log file is set to be a pipe, but Tomcat can&#8217;t seem to start with it. A quick fix will be to recreate it as a regular file with the same security settings and restart Tomcat. $ cd /var/log/tomcat5.5 $ sudo rm catalina.out $ sudo touch catalina.out $ sudo chown [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2008/01/problems-with-ubuntu-710-and-tomcat-55' rel='bookmark' title='Permanent Link: Problems with Ubuntu 7.10 and Tomcat 5.5'>Problems with Ubuntu 7.10 and Tomcat 5.5</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>For the Ubuntu installation, Tomcat&#8217;s log file is set to be a pipe, but</p>
<p>Tomcat can&#8217;t seem to start with it. A quick fix will be to recreate it<br />
as a regular file with the same security settings and restart Tomcat.</p>
<pre>$ cd /var/log/tomcat5.5
$ sudo rm catalina.out
$ sudo touch catalina.out
$ sudo chown tomcat55:nogroup catalina.out
$ sudo chmod 600 catalina.out</pre>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2008/01/problems-with-ubuntu-710-and-tomcat-55' rel='bookmark' title='Permanent Link: Problems with Ubuntu 7.10 and Tomcat 5.5'>Problems with Ubuntu 7.10 and Tomcat 5.5</a></li>
<li><a href='https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-710' rel='bookmark' title='Permanent Link: Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10'>Tomcat 5.5 Doesn&#8217;t Start in Ubuntu 7.10</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/10/tomcat-55-doesnt-start-in-ubuntu-704/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Tomcat and Apache with mod_jk Connector</title>
		<link>https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector</link>
		<comments>https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector#comments</comments>
		<pubDate>Fri, 08 Jun 2007 16:09:13 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=101</guid>
		<description><![CDATA[Using the mod_jk connector is an alternative but more complex method of integrating Tomcat and Apache together. The concept behind this method is to have Apache serve the static content of the website, and Tomcat to serve the Java related content. This could be a better alternative if your website contains mostly HTML pages. The [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Using the <code>mod_jk</code> connector is an alternative but more complex method of integrating Tomcat and Apache together. The concept behind this method is to have Apache serve the static content of the website, and Tomcat to serve the Java related content. This could be a better alternative if your website contains mostly HTML pages.</p>
<p>The <code>mod_jk</code> connector along with <code>mod_proxy_ajp</code> are the only recommend methods of Tomcat and Apache integration. <code>mod_jk</code> is still actively under development, and is very stable for production servers, as well it supports both Apache 1.3, and 2.x. Other past alternatives like <code>mod_webapp</code>, <code>mod_jserv</code>, <code>mod_jk2 </code>are not longer supported and are consider deprecated.</p>
<p><strong><code>mod_jk</code> Package Issue for Ubuntu</strong></p>
<p>For Ubuntu 7.04 there is an error in the <code>mod_jk</code> package. It currently has two packages for <code>mod_jk</code>:</p>
<ul>
<li><code>libapache-mod-jk</code> which depends on apache</li>
<li><code>libapache2-mod-jk2</code> which depends on apache2</li>
</ul>
<p>As mention previously, <code>mod_jk2</code> is already deprecated and <code>mod_jk</code> works for both Apache 1.3, and 2.x.</p>
<p>To properly configure Tomcat and Apache to use <code>mod_jk</code> the connector must be manually, build and set up from the source.</p>
<p><strong>Installing and Configuring <code>mod_jk</code></strong></p>
<p>Download and extract the latest connector from the Tomcat website <a title="http://tomcat.apache.org/download-connectors.cgi" href="http://tomcat.apache.org/download-connectors.cgi">http://tomcat.apache.org/download-connectors.cgi</a>, then configure and build it:</p>
<pre>$ cd tomcat-connectors-1.2.23-src/native
$ ./buildconf.sh
$ ./configure --with-apxs=/usr/bin/apxs2
$ make; make install</pre>
<p>Verify the <code>mod_jk.so</code> module exist in the apache module directory <code>/usr/lib/apache2/module</code>.</p>
<p><em>Note: </em>The programs are required to configure and build the connector: <code>automake</code>, <code>autoconf</code>, <code>libtoolize</code>, and <code>apxs2</code>. To obtain these programs install the following packages in Ubuntu: <code>libtool</code>, <code>automake</code>, and <code>apache2-threaded-dev</code></p>
<p><strong><em><code>libtool</code> error when compiling</em></strong></p>
<p>On some systems the <code>'make'</code> command will fail with the following error:</p>
<pre>libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'</pre>
<p>This is due to <code>libtool</code> not using the correct <code>gcc</code> when compiling. A workaround would be to add the parameter <code>'--tag CXX'</code> inside the <code>Makefile</code>.</p>
<pre>$ cd  tomcat-connectors-1.2.23-src/native/common
$ nano Makefile</pre>
<p>Inside the Makefile the change line from:</p>
<p><code>LIBTOOL = /usr/share/apr-1.0/build/libtool --silent</code></p>
<p>to:</p>
<p><code>LIBTOOL = /usr/share/apr-1.0/build/libtool --silent --tag CXX</code></p>
<p><strong>Creating the <code>workers.properties</code></strong></p>
<p>Create a <code>workers.properties</code> file in the Apache configuration directory and add the following lines to it.</p>
<p><code>$ nano /etc/apache2/workers.properties</code></p>
<pre># This file provides minimal jk configuration properties needed to
# connect to Tomcat.
workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/lib/java-1.5.0-sun
ps=/
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1</pre>
<p><strong>Configure Apache for <code>mod_jk</code></strong></p>
<p>Create the jk module configuration files for Apache</p>
<p><code>$ nano /etc/apache2/mods-available/jk.load</code></p>
<p><code>LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so</code></p>
<p><code>$ nano /etc/apache2/mods-available/jk.conf</code></p>
<pre>&lt;IfModule mod_jk.c&gt;
    # Where to find workers.properties
    JkWorkersFile /etc/apache2/workers.properties</pre>
<pre>    # Where to put jk logs
    JkLogFile /var/log/apache2/mod_jk.log

    # Set the jk log level [debug/error/info]
    JkLogLevel info

    # Select the log format
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

    # JkOptions indicate to send SSL KEY SIZE,
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

    # JkRequestLogFormat set the request format
    JkRequestLogFormat "%w %V %T"

    # Globally deny access to the WEB-INF directory
    &lt;LocationMatch '.*WEB-INF.*' &gt;
         Order deny,allow
         Deny from all
    &lt;/LocationMatch&gt;
&lt;/IfModule&gt;</pre>
<p>After creating the configuration files you can now enable the jk module for Apache</p>
<p><code>$ a2enmod jk</code></p>
<p><strong>Sending JSP and Servlets through <code>mod_jk</code></strong></p>
<p>Inside the virtual host you can mount JSP and Servlet context to the worker define in the <code>workers.properties</code> file. For example to mount the JSP and Servlet examples from Tomcat add the following lines:</p>
<pre>JkMount /jsp-examples/*.jsp worker1
JkMount /servlets-examples/servlet/* worker1</pre>
<p><strong>Apache <code>DirectoryIndex</code></strong></p>
<p>If your website uses <code>index.jsp</code> it must be download inside the <code>DirectoryIndex</code> of Apache. Modified the file <code>/etc/apache2/mods-enabled/dir.conf</code> and add <code>index.jsp</code> to the list.</p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Tomcat and Apache Using Proxy</title>
		<link>https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy</link>
		<comments>https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy#comments</comments>
		<pubDate>Wed, 30 May 2007 16:07:30 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=100</guid>
		<description><![CDATA[This easiest way to integrate Tomcat and Apache together is to have Tomcat run behind Apache which behaves like a proxy server. Enable the proxy module for Apache. $ a2enmod proxy $ a2enmod proxy_http (To allow Apache to forward to Tomcat HTTP Connector) Include the following in the Apache configuration file: ServerName tomcat.example.com ProxyPass / [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy' rel='bookmark' title='Permanent Link: Apache mod_proxy and Reverse Proxy'>Apache mod_proxy and Reverse Proxy</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This easiest way to integrate Tomcat and Apache together is to have Tomcat run behind Apache which behaves like a proxy server.</p>
<p>Enable the proxy module for Apache.</p>
<p><code>$ a2enmod proxy</code> <code><br />
$ a2enmod proxy_http</code> (To allow Apache to forward to Tomcat HTTP Connector)</p>
<p>Include the following in the Apache configuration file:</p>
<pre>ServerName tomcat.example.com</pre>
<pre>ProxyPass / http://localhost:8080/
ProxyPassReverse  /  http://localhost:8080/</pre>
<p>The above example tells Apache to forward URLs from http://tomcat.example.com/* to Tomcat&#8217;s Http Connector which is setup to be listening on port 8080 and assumes that you have setup a virtual host in Tomcat for tomcat.example.com.</p>
<p>When you are running behind a proxy server, you will sometimes prefer to manage the values returned by:</p>
<ul>
<li><code>ServletRequest.getServerName()</code>: Returns the host name of the server to which the request was sent.</li>
<li><code>ServletRequest.getServerPort()</code>: Returns the host name of the server to which the request was sent.</li>
</ul>
<p>In general, you may want the port number to reflect that specified in the original request, not the one on which the HTTP Connector itself is listening. You can use the <code>proxyName</code> and <code>proxyPort</code> attributes on the <code>&lt;Connector&gt; </code>element to configure these values.</p>
<p>In the <code>server.xml</code> you can uncomment the line similar to the one below, if you still want to keep the HTTP Connector to continue listening on 8080.</p>
<pre>&lt;Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100" connectionTimeout="20000"
proxyName="www.mycompany.com"
proxyPort="80" disableUploadTimeout="true" /&gt;</pre>
<p>After you have restarted Tomcat, <code>ServletRequest.getServerName()</code>, and <code>ServletRequest.getServerPort()</code> will return <code>www.mycompany.com</code> and <code>80</code> respectively.</p>
<p><strong>Using the AJP Connector</strong></p>
<p>AJP is an optimized version of the HTTP protocol to allow a web server such as Apache talk to Tomcat. When integrating Tomcat with Apache, the AJP connector will provide faster performance than proxied HTTP.</p>
<p>Enable APJ proxy module in Apache:</p>
<p><code>$ a2enmod proxy_ajp </code></p>
<p>In the Apache configuration file add the following:</p>
<pre>ProxyPass / ajp://localhost:8009/
ProxyPassReverse  /  ajp://localhost:8009/</pre>
<p>The default port used by the AJP connector in Tomcat is 8009, and can be enable using the following line inside the <code>server.xml</code> file.</p>
<p><code>&lt;Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /&gt;</code></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy' rel='bookmark' title='Permanent Link: Apache mod_proxy and Reverse Proxy'>Apache mod_proxy and Reverse Proxy</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat 5.5 for Ubuntu Quickstart Guide</title>
		<link>https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide</link>
		<comments>https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide#comments</comments>
		<pubDate>Tue, 29 May 2007 16:05:13 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=99</guid>
		<description><![CDATA[Apache Tomcat is a web container developed at the Apache Software Foundation (ASF). Tomcat implements the servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, providing an environment for Java code to run in cooperation with a web server. Installing Tomcat for Ubuntu $ sudo apt-get install tomcat5.5 Starting and Stopping Tomcat The /etc/init.d/tomcat5.5 [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Apache Tomcat is a web container developed at the Apache Software Foundation (ASF). Tomcat implements the servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, providing an environment for Java code to run in cooperation with a web server.</p>
<p><strong>Installing Tomcat for Ubuntu</strong></p>
<p><code>$ sudo apt-get install tomcat5.5</code></p>
<p><strong>Starting and Stopping Tomcat<br />
</strong></p>
<p>The <code>/etc/init.d/tomcat5.5</code> script and the following options {<code>start</code> | <code>stop</code> | <code>restart</code> | <code>try-restart</code> | <code>force-reload</code> | <code>status</code>} is use to control the server.</p>
<p><strong>Directories and Configuration Files</strong></p>
<ul>
<li><code>/etc/tomcat5.5</code> Configuration directory for Tomcat</li>
<li><code>/var/lib/tomcat5.5</code> Base directory (<code>CATALINA_BASE</code>) for Tomcat</li>
<li><code>/usr/share/tomcat5.5</code> Home directory (<code>CATALINA_HOME</code>) for Tomcat</li>
</ul>
<p>The default configuration can be found at <code>/etc/default/tomcat5.5</code> as well the directory <code>/etc/tomcat5.5</code> contains other configuration files:</p>
<ul>
<li><code>server.xml</code> The server configuration file for Tomcat.</li>
<li><code>web.xml</code> The default deployment descriptor.</li>
<li><code>policy.d</code> This directory contains several policy files for SecurityManager. During start up these files will be appended together to auto generate the <code>catalina.policy</code> in the <code>$CATALINA_BASE/conf/</code> directory.</li>
</ul>
<p><strong>Running Tomcat&#8217;s Servlet and JSP Examples </strong></p>
<p>To install Tomcat&#8217;s example applications</p>
<p><code>$ apt-get install tomcat5.5-webapps</code></p>
<p>The examples will be installed in the <code>/usr/share/tomcat5.5-webapps</code> directory. To view the examples point your browser to http://localhost:8180, where 8180 is the default port for the Tomcat installation. To change it, modify the HTTP Connector in the <code>server.xml </code>file:</p>
<p><code>&lt;Connector port="8180" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /&gt;<br />
</code></p>
<p>For more information on the HTTP Connector refer to <a title="http://tomcat.apache.org/tomcat-5.5-doc/config/http.html" href="http://tomcat.apache.org/tomcat-5.5-doc/config/http.html">http://tomcat.apache.org/tomcat-5.5-doc/config/http.html</a></p>
<p><strong></strong></p>
<p><strong>Enabling/Disabling SecurityManager</strong></p>
<p>The default installation of Tomcat has SecurityManager is enabled in the startup script. To enable/disable SecurityManager edit the file <code>/etc/init.d/tomcat5.5</code> and set the variable <code>TOMCAT5_SECURITY</code> to <code>yes/no</code>.</p>
<p>An alternative is to modified the file <code>/etc/default/tomcat5.5</code>.</p>
<p><strong>Defining Virtual Host</strong></p>
<p>To define a new virtual host modify the <code>server.xml</code> and add a new host inside the Catalina Engine container.</p>
<pre>&lt;Engine name="Catanlina" defaultHost="localhost"&gt;
    &lt;Host name="www.example.com" appBase="/path/to/webapp"
     unpackWARs="true" autoDeploy="true"
     xmlValidation="false" xmlNamespaceAware="false"&gt;
        &lt;Alias&gt;example.com&lt;/Alias&gt;
        &lt;Context path="/" docBase="/example"/&gt;
     &lt;/Host&gt;
&lt;/Engine&gt;</pre>
<p>If the <code>Context</code> is not defined the default <code>docBase</code> would be <code>ROOT</code>, i.e. you will need to deploy you application in <code>/path/to/webapp/ROOT</code>.</p>
<p>For more information on the Host configuration attributes refer to <a title="http://tomcat.apache.org/tomcat-5.5-doc/config/host.html" href="http://tomcat.apache.org/tomcat-5.5-doc/config/host.html">http://tomcat.apache.org/tomcat-5.5-doc/config/host.html</a>.<br />
For more informaton on the Context configuration attributes refer to <a title="http://tomcat.apache.org/tomcat-5.5-doc/config/context.html" href="http://tomcat.apache.org/tomcat-5.5-doc/config/context.html">http://tomcat.apache.org/tomcat-5.5-doc/config/context.html</a></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
