Railo 3: JBoss and Apache

This is a translated repost of an article written by Markus Skrabal. I found the article very informative and thought that all the non-German folks might also benefit. This isn't a pure translation as I added my own "voice" as well as added and edited some of the content.

Railo and Apache on JBoss

In order for you to get Apache and Railo to work on JBoss a few modules need to be able to communicate with each other. The installation and setup of those modules is described below.


Required Software:

Railo (, Apache, JBoss, and finally MOD_JK


Install JBoss, Railo and Apache. For instructions on how to install Railo on Jboss you can see my blog post Deploying Railo 3 to JBoss.


With Jboss installed to c:\Jboss and Apache installed to c:\APACHE we can load the MOD_JK connector. After getting the correct version for your environment, in my case version mod_jk-1.2.26-httpd-2.0.59.so, drop it into the c:\APACHE\modules directory and rename it to mod_jk.so

That's it for required software now we can concentrate on the configuration.

Configuring Apache:

Open the httpd.conf file located in the c:\APACHE\conf folder and look for the loadModules block and add the following:
# JBOSS Connector
LoadModule jk_module modules/mod_jk.so
Add the following to the end of the httpd.conf file:
# Include mod_jk configuration file
Include conf/mod_jk.conf

Don't forget to save the file!

Configuring the Connector

Still in the c:\APACHE\conf create a file called mod_jk.conf. Copy the following into your emtpy mod_jk.conf file and save it.

# Where to find workers.properties
JkWorkersFile conf/worker.properties

# Where to put jk logs JkLogFile logs/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 indicates to send SSK KEY SIZE # Note: Changed from +ForwardURICompat. # See http://tomcat.apache.org/security-jk.html JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories

# JkRequestLogFormat JkRequestLogFormat "%w %V %T"

# You can use external file for mount points. # It will be checked for updates each 60 seconds. # The format of the file is: /url=worker # /examples/*=loadbalancer JkMountFile conf/uriworkermap.properties

# Add shared memory. # This directive is present with 1.2.10 and # later versions of mod_jk, and is needed for # for load balancing to work properly # Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452 JkShmFile run/jk.shm

Configuring the Worker

Create a new file in c:\APACHE\conf called worker.properties and add the following:

# Define Node1# modify the host as your host IP or DNS name. worker.node1.port=8009 worker.node1.host=localhost worker.node1.type=ajp13 worker.node1.lbfactor=1

Since we only have one JBoss instance installed you only need to specify one worker, with more instances you can specify more workers which allows it to act as a software load balancer. The worker will try to communicate with JBoss over AJP through port 8009.

Save and close the worker.properties file.

Application Mapping

Create a new file in c:\APACHE\conf with the name uriworkermap.properties and add the following:

# Mount your applications
Important: Make sure that in the Railo META-INF directory that the application.xml file contains <context-root>/railo</context-root>

Thats the last of the Apache configurations, now we just need to make a couple changes to JBoss.

Configuring JBoss (4.2.2GA)

In the JBoss deployment folder (\server\default\deploy) should be a folder called jboss-web.deployer that contains the integrated JBoss web-server (Tomcat). We need to deactivate the default web-server and set it to AJP. To do this we need to edit the server.xml located in this directory. Find and comment out the following:

<!-- This is the default JBOSS webserver Port (HTTP) <Connector port="8080" address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" /> -->

We also need to deactivate the HTTPS part

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" keystoreFile="${jboss.server.home.dir}/conf/ssl.keystore"
keystorePass="mypassword" keyAlias="testkey1"
sslProtocol="TLS" />

and lastly search for the following section and make sure that its NOT commented out.

<Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
emptySessionPath="true" enableLookups="false" redirectPort="8443" />

<Engine name="jboss.web" defaultHost="node1">

Finishing Up

Finally! we are done. You just need to restart JBoss and Apache and voila Apache will now be your web-server.

Related Blog Entries

15 Comments to "Railo 3: JBoss and Apache"- Add Yours
AJ Mercer's Gravatar Hi Gary,

Do you know if these instructions will work for JBoss 5?

I have Ubuntu JBoss 5 RC1 Railo 3005 Apache 2.2.8

My Apache is throwing an error on
# Posted By AJ Mercer | 10/9/08 9:39 AM
Gary's Gravatar Honestly I am not sure, I don't have an Ubuntu or JBoss 5 installed. Will get back to you on this one.
# Posted By Gary | 10/10/08 3:38 AM
Christian Ready's Gravatar Hi Gary,

I'm following your tutorial, but I do not have a META-INF folder or an application.xml anywhere underneath my JBoss or railo.war directories. Do you know where I would find this?
# Posted By Christian Ready | 10/13/08 2:30 PM
Gary Gilbert's Gravatar Hi Christian,

This deployment should be for deploying railo as an EAR not a WAR, thanks for catching that, I will have to add the correct instructions for the base install of Railo as an ear on Jboss.
# Posted By Gary Gilbert | 10/14/08 3:45 AM
Joel Stobart's Gravatar Gary,

Thanks for this. I have used your instructions, and they work great for ubuntu, and jboss 5

The server.xml is in a different place
You need to use your ear approach rather than the war approach described.
If ou are using virtual directories you need to define a differend file for each virtual directory

took a little while - but is all fine!

- Joel
# Posted By Joel Stobart | 12/6/08 1:33 PM
Rahul Basu's Gravatar Hey i get [MsgAjp] BAD packet signature 18245 this error but no railo is involved in my app.
# Posted By Rahul Basu | 2/4/09 10:35 AM
Jeff Chastain's Gravatar Are there any resources for taking the next step with this configuration? I have gotten this far, but what I am having trouble with is setting up an application outside of the JBoss/Railo app server such that only requests for .cfm/.cfc are passed to JBoss and Railo instead of every request? With IIS/JRun, you have your application code this involves setting up handler mappings that map each path (*.cfm) to a given DLL under JRun. I cannot find any information about setting this up with Railo/JBoss though?
# Posted By Jeff Chastain | 2/23/09 6:39 PM
Jamie Krug's Gravatar @Jeff: I'm pretty sure you can use JBoss(Tomcat) Host/context XML entries to use application roots outside the JBoss/Railo app directory, but I think this also requires context paths in your URLs (or mapping the context paths by proxying from Apache). That said, I ended up happy with the way things work by using the Railo jars deployment instead of EAR/WAR. I still don't know enough to know whether this is a good idea, but it definitely works. Here's the basics:
# Posted By Jamie Krug | 3/3/09 8:47 PM
steve's Gravatar Thanks for the straight forward write up. I was able to get this working with apache 2.2 and JBOSS 5.0 fairly easy.

Is there any advantage using the apache http server over using JBOSS' http server?
# Posted By steve | 3/20/09 5:13 AM
Shimju's Gravatar Gary,
Following your blog entries I have deployed Railo over JBOSS on Apache webserver on my windows vista.
Now I can access Railo admin from apache (port I have used is 1000 for Apache Installation) like http://localhost:1000/railo/railo-context/admin/we.....
So I feel installation is fine.
Now my biggest issue is how can I configure New Website? I have seen your post http://www.garyrgilbert.com/blog/index.cfm/2008/9/... which is using Resin, but on apache and Jboss how it is done? When I just try to access a .cfm file from apache webroot it is not processing coldfusion file at all.. Please advice?
# Posted By Shimju | 4/7/09 8:54 PM
andrea's Gravatar Hi Gary,

good post.
I am trying Railo 3.1 with jboss 5 and apache 2.2.
I am a noob on apache so .... jboss was running on 8080 an I have deployed railo as war and was running ok.
I added mod_jk with the settings you provided and restarted both jboss and apache...
localhost:8080 that was jboss do not answer and is ok.
localhost:8888 that is apache answer but do not process cfm

Any suggestion?



I am on vista
# Posted By andrea | 4/10/09 11:45 AM
Gary Gilbert's Gravatar @Andrea,

It sounds like your virtual host is not actually passing off the calls to .cfm files from Apache to Tomcat. Check your Apache Conf file.
# Posted By Gary Gilbert | 4/11/09 9:33 AM
andrea's Gravatar I am sure my issue reside in the setting of the apache host. I am quite new to apache. How shoudl you create the host in apche to run teh cinfiguration you created in the post??
Thanks Andrea
# Posted By andrea | 4/11/09 9:42 PM
andrea's Gravatar Hi Gary,

this is my virtual host in apache:

<VirtualHost *>
   DocumentRoot "D:/wwwroot/"
   ServerName localhost
   #Welcome files
   DirectoryIndex index.cfm index.php index.htm index.html index.html.var
   JkMount /* worker

I still cannot send pages to connector.

Any suggestion?

# Posted By andrea | 4/11/09 10:22 PM
Gary Gilbert's Gravatar Hi Andrea,

Take a look at this other post of mine that I did with Apache and Tomcat.

# Posted By Gary Gilbert | 4/13/09 2:05 PM

Powered By Railo


Subscribe via RSS
Follow garyrgilbert on Twitter Follow me on Twitter
Or, Receive daily updates via email.


adobe air ajax apple cf community cfml coldfusion examples ext flash flex google javascript jquery max2007 max2008 misc open source programming railo software technology ui

Recent Entries

No recent entries.


An Architect's View
Rey Bango

Wish List

My Amazon.com Wish List