An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Entries for month: October 2013

Upgrading Railo 3 to Railo 4

October 23, 2013 ·

At World Singles, we're just going thru the process of upgrading from Railo 3 to Railo 4 (specifically from 3.3.4 to 4.1.1) and I thought I'd jot down a quick blog post about it. First off, I should explain that we use the WAR install on a vanilla Tomcat install, and mod_proxy_ajp to connect Apache to Tomcat. See my Railo for Dummies blog post from 2009 about setting up that sort of environment for background. We have three web contexts (web applications), each running their own configured WAR install of Railo, so we can package each web application up easily and move it around, including the Railo runtime. We can also upgrade each web application separately.

We'd already upgraded from Java 6 to Java 7 (download and unpack the JDK from Oracle into a new folder, update the symlink for the default java executable), and from Tomcat 6 to Tomcat 7 (download and unpack the Tomcat archive from Apache into a new folder, update the symlink for the current version, copy and context.xml from the old to the new - we'd customized those - and then add <Host..> entries to server.xml as necessary). Piece of cake so far.***

I expected the Railo upgrade to be more work than Tomcat. I was wrong. A pleasant surprise! I downloaded the new Railo 4.1.1 WAR file and unpacked it into a temporary folder (using jar xf /path/to/railo- Then I copied the WEB-INF folder over my existing Railo installations:

tar cf - WEB-INF | ( cd /path/to/application/webroot; tar xf - )

That's just my go to method for non-destructively copying a whole directory tree on top of an existing set of files. The only file that needed customization was web.xml in one web application context where we had some SES URL patterns that matched subfolders. That was just a matter of adding three <url-pattern> lines to the <servlet-mapping> section for the CFMLServlet. That's all it took: download, unpack, copy (and a small edit). Started up Tomcat and Railo happily deployed itself into each web application context, without overwriting any of my previous Railo 3.3.4 settings in the three admins. Nice!

Any code changes? Yes, just two: ColdBox has a MessageBox plugin that uses isEmpty() which is now a built-in function - changing the two unqualified calls to this.isEmpty() solved that - and a couple of strange places where I'd accidentally used float and int as function return types in cfscript - this worked in Railo 3 as if I'd written numeric but in Railo 4 it was type checked as a Java primitive type (interesting in itself!) so I just changed those to numeric and everything else just worked!

***Piece of cake except for Braintree which is one of our payment providers. We were using an older version of their library and once we moved to Java 7, the security certificate processing was more strict and calls to their sandbox (not their production system) failed. Updating to the latest Braintree JAR on Maven Central fixed that.

Tags: coldfusion · coldbox · railo

cf.Objective() 2014 - call for speakers!

October 21, 2013 ·

The cf.Objective() 2014 Call for Speakers is open until November 1st so you have just under two weeks to submit your topics. You can also vote for existing topic submission at that same link.

Right now we've only had two general CFML topics submitted (and seven ColdBox-related ones!) but there's a good number of JavaScript-related submissions - and remember that cf.Objective() has a dedicated JavaScript track in js.Objective(), as well as a mobile/front-end track so it's more than a CFML conference... but we still want to see a good spread of CFML topics!

And if you want to submit non-CFML web development topics that you think would appeal to a CFML / JS audience in terms of broadening their skills, you should do that too! Last year Scott Stroz did an excellent talk about Groovy on Grails, and I touched on some advanced CFML techniques inspired by other languages in my polyglot talk.

Note: when you submit a talk, please make sure to follow the guidelines outlined in this blog post about cf.Objective() 2014 submission format!

Tags: cfobjective · clojure · coldbox · coldfusion · grails · groovy · javascript · programming

lein-try rocks - instant HTTP server!

October 17, 2013 ·

The lein-try plugin is one of the more stunningly useful "little pieces" of software that you can have available if you're developing in Clojure. Simply add the plugin to your user profile (in ~/.lein/profiles.clj) and then lein try some-dependency will fire up a REPL with the specified dependency on the classpath.

Today, I needed a simple HTTP server running for a short while, serving up static assets from a specific folder tree. Instead of messing with my local Apache setup, I used lein-try to fire up a temporary HTTP server:

> lein try ring/ring-core 1.2.0 ring/ring-jetty-adapter 1.2.0
user=> (use 'ring.adapter.jetty)
user=> (use 'ring.middleware.resource)
user=> (def app (wrap-resource (constantly {:headers {"Location" "index.html"} :status 301}) "."))
user=> (run-jetty app {:port 3333})
2013-10-17 18:03:14.792:INFO:oejs.Server:jetty-7.6.8.v20121106
2013-10-17 18:03:14.819:INFO:oejs.AbstractConnector:Started SelectChannelConnector@

That starts a Jetty instance on port 3333 with a very simple Ring-based web application:

  • If static assets are requested, they are served up (by wrap-resource) relative to the current folder ("."),
  • Else you are redirected to index.html.

Tags: clojure