Jun 27 2008

Deploying Railo WAR on JBoss 4.2.2

Posted by Joe Rinehart at 3:22 PM
3 comments
- Categories: Hiberailooving | Railo

Beta 2 of Railo 3.0 is available, and one of its download options is as a WAR suitable for any JEE server. In the Hiberailooving series, I'm building up a Hibernate + Railo + Groovy + Spring platform, and JBoss will be its intended deployment platform.

When you download the WAR, all you get is (literally) the WAR itself. To get it up and running in JBoss, you'll want to:

  1. Unzip the WAR and deploy to your /deploy directory. I used a new Dynamic Web Project in Eclipse to make this easier to manage, calling my project Railo and running in the context-root of Railo.
  2. Write a web.xml that configures the proper servlets/filters to start serving up CFML. I ripped and modified the one from the Railo Express distribution, modifying the Jetty-style filters to suit JBoss. For your convenience, it follows.

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
   <display-name>Railo</display-name>
      
   <servlet>
      <servlet-name>CFMLServlet</servlet-name>
      <servlet-class>railo.loader.servlet.CFMLServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>   
   
   <servlet>
      <servlet-name>AMFServlet</servlet-name>
      <servlet-class>railo.loader.servlet.AMFServlet</servlet-class>
      <load-on-startup>2</load-on-startup>
   </servlet>
         
   <servlet-mapping>
      <servlet-name>CFMLServlet</servlet-name>
      <url-pattern>*.cfm</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
      <servlet-name>CFMLServlet</servlet-name>
      <url-pattern>*.cfml</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
      <servlet-name>CFMLServlet</servlet-name>
      <url-pattern>*.cfc</url-pattern>
   </servlet-mapping>

   <welcome-file-list>
      <welcome-file>index.cfm</welcome-file>
      <welcome-file>index.cfml</welcome-file>
   </welcome-file-list>
</web-app>

Conclusion

Deploy the unzipped WAR, drop the XML above into WEB-INF/web.xml, and you should have a running CFML server. No admin, though, so I'm not too sure how to add a datasource....

Comments

Steven Erat

Steven Erat wrote on 06/27/08 5:09 PM

Does Railo come with an AdminAPI? If so you can build a mini-CFAdministrator for common functions.
Barney

Barney wrote on 06/30/08 12:03 PM

I talked to Gert last week, and he said they'd be delivering a real WAR for the next release. The current WAR works just dandy, as long as you're installing it into an existing Railo Express installation.
Tom Lenz

Tom Lenz wrote on 07/04/08 6:28 AM

I followed your instructions here. So let's say I did everything right, how can I run a cfm file now? For example, there's an index.cfm file in the serverdefaultdeploy directory, how do I run that one?

Write your comment



(it will not be displayed)