Common Issues Migrating Existing Codebases to Lucee Coldfusion

Lately I’ve been migrating a lot of old Adobe CF sites to new Lucee installs. There’s a few differences between the two flavors of Coldfusion, but for the most part it Just Works. I’ve written the blog post below with some of the issues I’ve experienced. Hopefully this helps someone.

Have you migrated to Lucee? What issues did you find?


Does your site use Cfform Tags?

You may need to install and/or activate the Form Tag plugin through the Lucee admin area menu option  “Extensions > applications”. If you do not see this plugin available you can  download it from Lucee.org and upload it via the upload feature at the bottom of the “Extentions > applications” page.

Does your site use Cfspreadsheet?

You may need to install and/or activate the spreadsheet plugin through the Lucee admin area menu option  “Extensions > applications”. If you do not see this plugin available you can  download it from Lucee.org and upload it via the upload feature at the bottom of the “Extentions > applications” page.

Does your site generate PDFs?

The PDFs created by Lucee will be formatted differently than the ones generated by Adobe Coldfusion.  You will need to tweak the formatting to get them to work correctly.

You may need to install and/or activate the pdf plugin through the Lucee admin area menu option  “Extensions > applications”. If you do not see this plugin available you can  download it from Lucee.org and upload it via the upload feature at the bottom of the “Extentions > applications” page.

Other Issues

– Lucee Coldfusion generates JSON keys in their original case. Adobe Coldfusion generates JSON keys in uppercase. (I may have this backwards) This may be an issue if you have anything consuming JSON that is case-sensitive.

– Lucee Coldfusion does not support the Adobe Coldfusion feature called “Flash Forms”. This was a very old feature Adobe added that presented web forms using flash instead of html. Usually it is straightforward to convert these forms into normal HTML forms.

– Lucee Coldfusion does not support Coldfusion Reporting files.  I’ve only encountered this once, but it was straightforward to re-implement the report as a pdf.

– I ran into an issue where the code was dynamically generating a new Query object using the QueryNew function. Lucee’s QueryNew was counting empty list items while Adobe’s QueryNew was not.  In Coldfusion the ListLen function ignores empty list items so Lucee’s implementation seems to not follow the Coldfusion convention.

– Occasionally Lucee reveals a bug that Adobe Coldfusion allowed to pass syntax checking. I don’t have an example handy, but at the time I wondered how Adobe CF interpreted what was an obvious bug.

Creating ‘vhosts’ when setting up a Lucee dev environment

Previously when setting up a dev environment using Adobe Coldfusion I would set up multiple development sites on the same Coldfusion install using Apache vhosts. There are other ways to do this using vms or containers, but I find keeping a local dev environment as simple as possible works best for me. If the sites are all Coldfusion, I put them together in one install. (If I’m working with a different technology, then its time to set up a separate dev environment for that, just not a new environment per-site.)

Once I moved to Lucee development, I wanted to replicate the same sort of thing using Apache Tomcat. The problem I had was that Tomcat doesn’t call them “vhosts” so it took a while to Google the correct term!

The following process is how I set up multiple dev sites under one Lucee install:

Step 1)

First, we will need to edit the server.xml file.  This file is located here for me:
c:\Lucee-express\conf\server.xml
But it might also be located here: /data/lucee/tomcat/conf/server.xml
The server.xml file may be in a slightly different place for you, but its always in the conf directory.

Add the following XML inside the “<Engine>” section

<Host name="YOUR_DOMAIN_NAME" appBase="webapps"
unpackWARs="true" autoDeploy="true" >
<Context path="" docBase="PATH_TO_WEBROOT" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>

Step 2)

Update your hosts file with YOUR_DOMAIN_NAME so that your browser will point to your local server instead of going out to the internet.

To your hosts file, add the entry:

127.0.0.1 YOUR_DOMAIN_NAME

Step 3)

restart Lucee

Finished!

Go to your browser and type “http://YOUR_DOMAIN_NAME”  Lucee should respond with the content in the PATH_TO_WEBROOT directory.  You may need to add a port # if your install of Lucee is configured to run on something other than port 80. My environment is configured to use port 8888 so I would need to type “http://YOUR_DOMAIN_NAME:8888

How to Turn on Server-side AD Authentication for Lucee

Here’s the instructions I use whenever I need to remember how to set up server-side Active Directory authentication on a Lucee server. These are really instructions for Apache Tomcat, which Lucee uses as its web server.

Step 1)

Define a global “Realm” that contains the LDAP config info.

We will need to edit the server.xml file.  This file is located here for me:
c:\Lucee-express\conf\server.xml
But it might also be located here: /data/lucee/tomcat/conf/server.xml
The server.xml file may be in a slightly different place for you, but its always in the conf directory.

Add the following XML inside the “<Engine>” section

<Realm className="org.apache.catalina.realm.JNDIRealm"
connectionURL="ldap://YOURSERVERNAME:PORT"
userSearch="(samAccountName={0})"
userSubtree="true"
userBase="YOURPARAMSGOHERE"
connectionName="USERNAME"
connectionPassword="PASSWORD"
/>

Your own AD creds should work for testing, but for production you should set up a service account to make this connection

Step 2)

Now that we have an LDAP Realm defined we need to tell the website to turn on basic authentication

Create an WEB-INF/web.xml file below your web root and stick all of the following XML in there:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>test</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.cfm</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.cfm</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name></web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>*</role-name>
</security-role>
</web-app>

Step 3)

Restart lucee

Finished!

Now, the user will be prompted to log in to the server using their AD credentials before hitting the website. The username will be in the cgi variables if the website needs this information.

If you need to turning on LDAP logging:

Step 1)

Add
org.apache.catalina.realm.level = ALL
org.apache.catalina.realm.useParentHandlers = true
org.apache.catalina.authenticator.level = ALL
org.apache.catalina.authenticator.useParentHandlers = true

to /data/lucee/tomcat/conf/logging.properties

Step 2)

Add
debug=”99″
to the end of your Realm like this:

<Realm className="org.apache.catalina.realm.JNDIRealm"
connectionURL="ldap://YOURSERVERNAME:PORT"
userSearch="(samAccountName={0})"
userSubtree="true"
userBase="YOURPARAMSGOHERE"
connectionName="USERNAME"
connectionPassword="PASSWORD"
debug="99"
/>

Sources

https://tomcat.apache.org/tomcat-8.0-doc/config/realm.html#JNDI_Directory_Realm_-_org.apache.catalina.realm.JNDIRealm
https://tomcat.apache.org/tomcat-8.0-doc/realm-howto.html#JNDIRealm
http://dev-answers.blogspot.com/2010/03/enable-debugtrace-level-logging-for.html

Jar Aquarium – Mystery Of The Rising Water Solved

Since setting up the jar aquarium two weeks ago the water level in the jar has been rising. I removed water multiple times to lower it back but it kept overflowing which had me very befuddled last week. I even marked the neck of the bottle with the height of the water at different times of the day. The water does go up when the sun warms the bottle, but it does not return to the starting point the next morning. It slowly continues to rise.

But I think I finally figured out the cause. Can you see it in the image below?

Bubbles. There is a large amount of gas trapped beneath the mud. These bubbles are created during the process that is breaking down the decaying plant life within the muck. The process probably goes faster when the sun hits warms the muck.

In the image above you can also see the tunnels that the worms have been making in the mud. I haven’t been able to capture a good photo of them.

I gave the bottle a good jolt and tons of bubbles streamed to the surface. Releasing the built up gas lowered the water level nearly back to its starting point.

Jar Aquarium – One Week Update

After one week the water in the jar aquarium has cleared up and now you can see everything that happens with the jar. Which isn’t much. The tiny insects that were swimming around the top of the jar seemed to have died off. There is still one worm that I suspect is really a leech.

It remains to be seen if the plants will continue to grow. Some of them are starting to look a little brown.

But despite lack of life, the jar aquarium does still have something I’ve been watching daily. There’s a mystery to the jar that I’m trying to solve. The water level keeps rising.

At first I thought it was just heat expansion. The jar does get some direct sun. But the water doesn’t seem to move much during the day. After reducing the water back down to its original levels three times and then finding that the water had again risen to the top of the jar I’m not sure what is going on.

We all know about the Conservation of Mass right? Matter cannot be created or destroyed it just changes form. I expected some movement due to heat expansion, but I thought it would go up and down with the temperature. I also expected all the plants and dead stuff in the mud to create methane and other gases that would bubble up. So far, no gas bubbles, but the water keeps rising. Something within the jar is increasing in volume. Could it really be just the water heating up?

What do you think? Put your ideas in the comments!

Update: Mystery Of The Rising Water Solved?

Getting The Honey Bees Ready For Winter

I checked in on the bees today to get them ready for winter.

First removed one of the boxes that had a hole in the corner. The bees seemed to love the extra entrance during the summer, but that hole would’ve let the cold in all winter so it had to go. The bees were very upset I was moving their honey around.

I scraped off some extra comb and got a little treat for myself.

There wasn’t much brood in the hive, which is a little worrying since most of the current bees will die soon and the bees that hatch out now have to survive all winter and keep the queen warm. That’s another thing that concerns me a little: I didn’t see the queen bee. I don’t always find her but I would’ve liked to confirm that she’s still alive before the winter. The bees were already getting angry with me so I did what I had to and got out as quick as possible.

I gave them their fall mite treatment and closed the hive back up.

Last thing I did was put the reducer in the entrance way. That will also help keep the cold out.

That’s it for today. Next time I check on the hive I will put a cork in the top entrance, and change the reducer to he smallest opening, again to keep out the cold. For now the fall has been very mild so I will leave it until we stay below freezing at night.

Jar Aquarium – First Twenty-Four Hours

I filled a one gallon jug one-third full of muck from the swamp then filled the rest with the swamp water and added some aquatic plants for good measure. When I was done it looked like this:

After twenty-four hours the water had cleared up a lot and now looked like this:

There’s even a few critters swimming around the top:

I’m hoping it will clear up even more this week and the plants will start to grow to create a self-sufficient ecosystem.