Lucee Installation on Solaris 11 (SPARC)

Here, we will look at the process of installing the Lucee CFML application server under Apache Tomcat 8 on Oracle Solaris 11 on SPARC machines. We will also set up an Apache proxy with mod_cfml to ease the process of deploying Apache VirtualHosts without having to configure each virtual host twice (in Apache itself, as well as Tomcat’s server.xml file).

My Setup

  • The server is a SunFire T2000 with an UltraSPARC-T1 CPU. Great performance for Java workloads like this.
  • I’m running Solaris 11.3, as 11.4 does not support the UltraSPARC-T1 CPU.
  • I’m running this setup in a Solaris non-global zone.

Prerequisites

You will need to install the following packages from the “solaris” Oracle IPS repository:

  • apache-22 (as of this writing, Apache 2.4 segfaults when using mod_proxy)
  • tomcat-8
  • gnu-make
  • gnu-sed

You will also need Oracle Solaris Studio 12.4, with its bin directory in your $PATH (ahead of any other path containing the “cc” binary), in order to get a C compiler that will take the options that Apache’s apxs module tool will attempt to use. This is a free download to those with an Oracle Technology Network (OTN) account, so you will need one of those too. As of this writing, OTN accounts are also free.

Newer versions of Oracle Solaris Studio/Oracle Developer Studio require a patch on UltraSPARC-T1 machines (Solaris SRU 20) to enable the VIS hardware capability. You must have a valid Oracle Solaris support contract to obtain this patch.

Please consult the appropriate Solaris documentation for how to install packages.

I have not tested this procedure on x86, or Solaris 11.4. If using versions of Solaris other than 11.3, or a different CPU architecture, your mileage may vary.

Installing Lucee Application Server

Steps

  1. Download the latest Lucee JAR file from https://download.lucee.org/
  2. Stop the Tomcat servlet container
  3. Place the downloaded JAR file into the Tomcat 8 lib directory
  4. Add Lucee’s servlet and mapping configuration to Tomcat web.xml
  5. Restart Tomcat
  6. Make sure Tomcat is running

Details

Downloading Lucee JAR File

Using your web browser, download the latest Lucee JAR file from https://download.lucee.org, and transfer it to your Solaris server (if not downloading directly from the server itself).

Stop Tomcat

svcadm disable svc:/network/http:tomcat8

Place JAR In Tomcat Lib Directory

cp /path/to/lucee-n.n.n.n.jar /usr/tomcat8/lib

Configure Lucee Servlet and Mappings

Open /var/tomcat8/conf/web.xml for editing, and add the following lines to the bottom of the file:

<servlet>
 <description>Lucee CFML Engine</description>
 <servlet-name>CFMLServlet</servlet-name>
 <servlet-class>lucee.loader.servlet.CFMLServlet</servlet-class>
 <load-on-startup>1</load-on-startup>
</servlet>

<servlet>
 <description>Lucee Servlet for RESTful services</description>
 <servlet-name>RestServlet</servlet-name>
 <servlet-class>lucee.loader.servlet.RestServlet</servlet-class>
 <load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
 <servlet-name>CFMLServlet</servlet-name>
 <url-pattern>*.cfm</url-pattern>
 <url-pattern>*.cfml</url-pattern>
 <url-pattern>*.cfc</url-pattern>
 <url-pattern>/index.cfc/*</url-pattern>
 <url-pattern>/index.cfm/*</url-pattern>
 <url-pattern>/index.cfml/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>RestServlet</servlet-name>
  <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

Start Tomcat

svcadm enable svc:/network/http:tomcat8

Make Sure Tomcat is Running

Type the following command:

svcs | grep tomcat8

You should see output similar to the following:

online         20:52:13 svc:/network/http:tomcat8

If the first column of output does not say online, check /var/tomcat8/logs/catalina.out for any error messages, and check /var/tomcat8/conf/web.xml for syntax errors and/or omissions before running svcadm restart svc:/network/http:tomcat8 again.

Configure Apache 2.2 Proxy

Steps

  1. Create /etc/apache2/2.2/conf.d/lucee_proxy.conf
  2. Restart the Apache SMF service
  3. Make sure Apache is running

Details

Create Proxy Configuration

In your favorite editor, open /etc/apache2/2.2/conf.d/lucee_proxy.conf, and place the following lines into it:

<IfModule mod_proxy.c>
 <Proxy *>
  Allow from 127.0.0.1
 </Proxy>

 ProxyPreserveHost On
 ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://127.0.0.1:8009/$1$2
 ProxyPassMatch ^/(.+\.cfchart)(/.*)?$ ajp://127.0.0.1:8009/$1$2
 ProxyPassMatch ^/(.+\.cfml)(/.*)?$ ajp://127.0.0.1:8009/$1$2
 ProxyPassReverse / ajp://127.0.0.1:8009/
</IfModule>

Restart Apache SMF Service

Type the following command into your terminal:

svcadm restart svc:/network/http:apache22

Make Sure Apache is Running

Type the following command:

svcs | grep apache22

You should see output similar to the following:

online         20:48:12 svc:/network/http:apache22

If the first column of output does not show online, check /etc/apache2/2.2/conf.d/lucee_proxy.conf for syntax errors and restart Apache 2.2 once more.

Build mod_cfml From Source

The mod_cfml project’s GitHub sources contain three invalid characters at the very beginning of mod_cfml.c. I have created an archive of the corrected sources, which is available at http://ftp.coherent-logic.com/pub/solaris/lucee/mod_cfml/mod_cfml-solaris-source.tar.gz (also available via FTP).

You will need to download this file to your Solaris server, and unarchive it with the following command:

tar zxf mod_cfml-solaris-source.tar.gz

This will leave a mod_cfml-master subdirectory in the place where you un-tarred the archive.

Navigate to mod_cfml-master/C, and type the following commands:

export PATH=/opt/solarisstudio12.4/bin:$PATH
APXS=/usr/apache2/2.2/bin/apxs gmake
APXS=/usr/apache2/2.2/bin/apxs gmake install

This will build mod_cfml.so and install it into /usr/apache2/2.2/libexec.

If you get errors during the build process, make sure you have typed all the above commands correctly, and that you have the gnu-make, gnu-sed, and Oracle Solaris Studio 12.4 correctly installed.

Configure Apache with mod_cfml

Steps

  1. Add mod_cfml configuration to /etc/apache2/2.2/httpd.conf
  2. Restart Apache 2.2
  3. Make sure Apache 2.2 is running

Details

Add mod_cfml Configuration to Apache 2.2

In your preferred editor, open /etc/apache2/2.2/httpd.conf and add the following lines to the bottom:

LoadModule modcfml_module libexec/mod_cfml.so
CFMLHandlers ".cfm .cfc .cfml"
LogHeaders false
LogHandlers false

Restart Apache 2.2

Type the following command:

svcadm restart svc:/network/http:apache22

Make Sure Apache 2.2 is Running

Type the following command:

svcs | grep apache22

You should see output similar to the following:

online         20:48:12 svc:/network/http:apache22

If the first column of output does not contain online, check /etc/apache2/2.2/httpd.conf to make sure you did not make any typos while adding the mod_cfml configuration lines to it, and restart Apache 2.2 once again.

Configure mod_cfml Valve in Tomcat 8

Steps

  1. Copy mod_cfml-valve_v1.1.05.jar to /usr/tomcat8/lib/
  2. Add valve configuration to /var/tomcat8/conf/server.xml
  3. Restart Tomcat 8 SMF service
  4. Make sure Apache 2.2 and Tomcat 8 are running

Details

Copy mod_cfml Valve JAR to Tomcat 8 Library Directory

You will need to now navigate to the mod_cfml-master/java directory created when you untarred mod_cfml in a prior step. Within that directory, type the following command:

cp mod_cfml-valve_v1.1.05.jar /usr/tomcat8/lib/

Add mod_cfml Valve Configuration to Tomcat 8

Open /var/tomcat8/conf/server.xml for editing, and find the <Host> entry that begins with the following:

<Host name="localhost"  appBase="webapps"
      unpackWARs="true" autoDeploy="true">

After the <Host> tag, but before </host>add the following lines of XML code:

<Valve
      className="mod_cfml.core"
      loggingEnabled="false"
      maxContexts="100"
      timeBetweenContexts="0"
      scanClassPaths="false" />

This will enable the mod_cfml valve for localhost.

Restart Tomcat 8 SMF Service

Type the following command:

svcadm restart svc:/network/http:tomcat8

Make Sure Tomcat 8 and Apache 22 are Running

Type the following command:

svcs | egrep "tomcat8|apache22"

You should see output similar to the following:

online         20:48:12 svc:/network/http:apache22
online         20:52:13 svc:/network/http:tomcat8

If the first columns of output don’t both read online, check /var/tomcat8/conf/server.xml for any inadvertent typos or syntax errors.

You should now be running Lucee successfully! In your favorite web browser, navigate to http://hostname/lucee/admin/server.cfm. If everything worked correctly, you should see the Lucee Server Administrator. Please set secure passwords for both the Server Administrator (global to the entire server), and the Web Administrator for each Lucee web context you create.

As you are now running mod_cfml, any VirtualHost entries you create in Apache will be set up for you automatically in Tomcat, without having to edit and maintain two sets of messy XML configuration files.

Enjoy!

 

1 thought on “Lucee Installation on Solaris 11 (SPARC)”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s