Installing Lucee on Tomcat 7/OS X

Lucee Server (www.lucee.org) is a new application server that sits on the JVM. The server can be downloaded as a war file and installed on Apache Tomcat (or any other servlet container) with just a few simple steps. This method is based on a blog post by Sean Corfield on installing Railo on Tomcat

  1. Download a copy of Apache Tomcat. Let's use the latest version of Tomcat 7 core, available at the Tomcat 7 download page.
     
  2. Install Tomcat by extracting the downloaded archive. I will extract the archive to my home folder, /Users/rmunn. For convenience, I rename the resulting folder from apache-tomcat-7.0.59 to tomcat
     
  3. Go into ./tomcat/webapps/. Delete the ROOT folder and ROOT.war.
     
  4. Next, go to the Lucee download page on BitBucket and download the latest lucee war file. (You can also clone the Lucee git repository and build Lucee from source, I will cover that in another post). 
     
  5. Rename the lucee war file to ROOT.war (note the capitalization). 
     
  6. Copy the renamed ROOT.war file into ./tomcat/webapps. 
     
  7. Create a directory called lucee in ./tomcat.
     
  8. Extract the contents of ROOT.war.
     
  9. Go into  ./tomcat/webappsROOT/WEB-INF/lib and copy everything in that folder to ./tomcat/lucee.
     
  10. Go into ./tomcat/bin
  11. Create a file called setenv.sh. Tomcat uses this file to set environment variables on startup. Open the file and add this line:
     
    JAVA_OPTS="-Xms256m -Xmx1024m -XX:MaxPermSize=128m  -javaagent:${CATALINA_HOME}/lucee/lucee-inst.jar";
  12. Go into ./tomcat/conf.
     
  13. Open catalina.properties. Replace the commented line in this text with the new line:
     
    #common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
    
    common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lucee,${catalina.home}/lucee/*.jar
    
  14. Open web.xml. Add the following code block just above this line:
     
    <!-- ================ Built In Servlet Mappings ========================= -->

     
  15. <servlet>
       <servlet-name>LuceeCFMLServlet</servlet-name>
       <description>CFML runtime Engine</description>
       <servlet-class>lucee.loader.servlet.CFMLServlet</servlet-class>
       <init-param>
    <param-name>configuration</param-name>
    <param-value>/WEB-INF/lucee</param-value>
    <description>Configuration directory</description>
    </init-param>   
       <!-- init-param>
    <param-name>lucee-server-root</param-name>
    <param-value>.</param-value>
    <description>directory where lucee root directory is stored</description>
    </init-param -->
       <load-on-startup>1</load-on-startup>
    </servlet>   
    <servlet>
       <servlet-name>LuceeAMFServlet</servlet-name>
       <description>AMF Servlet for flash remoting</description>
       <servlet-class>lucee.loader.servlet.AMFServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
    </servlet>   
    <servlet>
       <servlet-name>LuceeFileServlet</servlet-name>
       <description>File Servlet for simple files</description>
       <servlet-class>lucee.loader.servlet.FileServlet</servlet-class>
       <load-on-startup>2</load-on-startup>
    </servlet>

     

  16. Add index.cfm to the index document list at the very end of web.xml.
     
  17. Open a Terminal prompt. Follow these commands:
    
    $ cd tomcat/bin
    $ chmod 775 *
    ​$ ./startup.sh
  18. Next, open a web browser to localhost:8080/lucee/admin/web.cfm. You should see the Lucee Web admin login screen. Lucee is now installed.


Next Steps

From this point you can configure your Tomcat instance and set up your applications in Lucee.