Connecting Apache to Tomcat utilizing Mod_JK

February 21st, 2010 by Dave Turner

Mod JK is the Apache  to Tomcat Connector.  It allows one to serve Tomcat webapps from Apache Http server.

Steps to install.
Note: This is based off my machines setup Apache 2.2.14, Tomcat 6, Windows 7 64 Bit, Mod JK 1.2.28

1. Download Apache webserver, Install it and verify it is running see “http://httpd.apache.org/” for more information.

2. Download Tomcat, Install it and verify it is running. See “http://tomcat.apache.org/” for more information

3. Download the Apache Tomcat Connector and copy it to [APACHE_ROOT]/modules. See http://tomcat.apache.org/connectors-doc for more information.

I was able to download the MOD_JK here http://apache.multihomed.net/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/

4. Create a “workers.properties” file and place it at [TOMCAT_ROOT]/conf/jk

AJP13 worker is the preferred worker type that JK uses for communication between web server and Tomcat. Here is a simple implementation of the workers.properties file

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

5. Edit the Apache Configuration file [APACHE_ROOT]/conf/httpd.conf in the following way

LoadModule jk_module /modules/mod_jk-1.2.28-httpd-2.2.3.so
Include "[PATH_TO_TOMCAT]/conf/auto/mod_jk.conf"

6. Edit Server.xml in [TOMCAT_ROOT]/conf in the following manner.

Under the <Server> node add this

<Listener className = "org.apache.jk.config.ApacheConfig"
workersConfig="conf/workers.properties"
mod_Jk="[PATH_TO_APACHE]/modules/mod_jk.so"
jkLog="logs/mod_jk.log" jkDebug="info" noRoot="false"/>

Under the <Engine> node add this

Restart Tomcat.. You should see a new file [TOMCAT_ROOT]/conf/auto/mod_jk.conf

Restart Apache.. you should be good

In regards to the Flex 3 LinkButton backgroundColor

January 20th, 2010 by Dave Turner

The background color of Flex 3’s LinkButton is transparent and that setting doesnt seem to be updateable so visually the LinkButton has no backgroundColor property.

Which means the following code snippet does nothing..

(event.target as LinkButton).setStyle("backgroundColor", "#ff0000");

In my case the LinkButton took up the entire space of a GridItem so I was able to set the backgroundColor of the parent and that worked fine for me.

var gridItemRef:GridItem = (event.target as LinkButton).parent as GridItem;
gridItemRef.setStyle("backgroundColor", "#ff0000");

Another method to support a background Color for a LinkButton would be to wrap it in a canvas, but I do not like the added overhead for the canvas.  Skinning may also provide a solution but it just wasn’t necessary in my case.

I wonder what was Adobe’s thought process behind not allowing the background color to be edited?