I had just installed OSX Mavericks 10.9, and my ColdFusion 10 server didn’t work – worse it didn’t work after a reinstall. I had tried downloading an already modified mod_jk.so file, but that didn’t work for me either for some reason. I had to compile my own.
Please vote for this bug so Adobe fixes this problem with the CF10 installer:
Here is what I had to do to correct, and compile my own Adobe Apache connector for ColdFusion 10.
Shutdown ColdFusion & Apache
In a terminal window:
sudo apachectl stop cd /Applications/ColdFusion10/cfusion/bin ./coldfusion stop
Now you can work with Apache & ColdFusion 10 files while off.
Get Connector Source
Grab a copy of the source code, as Mike Nicholls pointed out in the bugbase comments from here:
Its free from the App Store and includes the defacto GCC compiler you’ll need.
Get Command-Line Tools
In the past, you had to download and install XCode, and then go into Preferences > Downloads and ask it to also install the command-line tools. In Mavericks, they smartly separated out the command-line tools from XCode. You still need both though. To install the command line tools (and you’ll need to reinstall them after Mavericks if you had it previously), open a terminal window and type:
Create a missing symlink
This one is not obvious, I had to google around for this issue. In a terminal window you need to create a missing symlink:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
Copy/paste that into your terminal window and execute it. It just creates a symlink for osx10.9xctoolchain inside XCode.
Brew Doctor ya self!
I do like HomeBrew, I’ve come to really love it. Of course, Mavericks kind of broke it – not unusual. When I ran this in a terminal window:
It complained about everything under /usr/local/ and told me I should chown that directory. In terminal I ran:
sudo chown -R robsherman:wheel /usr/local/
just replace my name with your account name, but do leave in the ‘wheel’ part. Now if you re-run brew doctor things should look ok. You may get a warning about the /usr/local/lib/libusb-1.0.0.dylib, but Mavericks seems to keep adding that item back no matter how many times I remove it.
Next, some of my items were out-of-date with the new Mavericks install. My compiler was barking at standard lib items. In terminal I simply typed:
This began the process of homebrew upgrading ALL my formulas. You may want to be more selective about what you upgrade by typing ‘brew upgrade libtool’ for example.
If this is the first time you’ve installed HomeBrew, you may need some additional things in order to compile the Apache connector. I already had all these things from a previous install so I’m not 100% sure if you’ll need any of it – I do recall when I tried to compile early on, I got some errors and it said my standard library was out of date which was fixed by fixing brew and upgrading the items I had in there.
Here is a list of my brew formulas (‘brew list’):
autoconf git libtool openssl readline
automake libgpg-error libyaml pkg-config ruby-build
cmake libksba mysql rbenv
I can say for certain you won’t need mysql, rbenv, ruby-build, or git just to compile.
If you don’t have these but want to add them just type:
brew install xxx
and replace xxx with the name of the brew formula above.
Working with the Adobe Apache connector source code
When you unzip the connector-source.zip file (do this anywhere, even your Downloads folder), you’ll get a connector-source folder with two sub-folders: native, and support.
As Mike Nicholls pointed out from the bugbase comment:
I replaced this line in /native/common/jk_map.c: strcpy(buf, rc); with: memmove(buf, rc, len + 1);
You can use a simple text editor to make (about line 207 in the code) this exact change and save it.
Time to Configure and Make
In a terminal window, change directories to the /native directory within connector-source. Mine was sitting in my download folder so this worked for me:
Next, run the configure command:
You should see a lot of things flash by in the terminal window. It’s testing and checking what is available to build and outputting a lot of ‘yes’ or ‘pass’ on the screen hopefully.
If there is an error, it will likely be the last thing you see in the prompt in Terminal. All errors are logged in the config.log file located here:
Open up that log file and review it, its really helpful in telling you what you may be missing. The few things that bit me initially was that I had reinstalled XCode, but didn’t have command-line tools, I was missing the symlink and one of my Brew formulas was out of date so I had to upgrade them with ‘brew upgrade’.
If you didn’t receive any errors next in the terminal window, type:
You’ll get lots of stuff in terminal window again, a few warnings and lots of checks. Anything in red is going to be a warning as well – don’t panic.
At the bottom of the terminal window, you should see something like:
target="all"; \ list='common apache-2.0'; \ for i in $list; do \ echo "Making $target in $i"; \ if test "$i" != "."; then \ (cd $i && /Applications/Xcode.app/Contents/Developer/usr/bin/make $target) || exit 1; \ fi; \ done; Making all in common make: Nothing to be done for `all'. Making all in apache-2.0 make: Nothing to be done for `all'.
Congratulations, you did it.
Copy your new mod_jk.so
You can do this through Finder, or you can do it through terminal window. Here is what I did in terminal window:
cp ~/Downloads/connector-source/native/apache-2.0/mod_jk.so /Applications/Coldfusion10/config/wsconfig/1/mod_jk.so
There is a space between mod_jk.so and /Applications. Make sure you have a folder /wsconfig/1/ as your folder could have a different number.
Double check Apache config settings
In your /etc/apache2/httpd.conf file make sure this is at the bottom:
Adobe puts quotes around the file path although its not necessary on a Mac. Next, open up your mod_jk.conf file and make sure everything there is valid. Mine is slightly modified to include some additonal ‘custom environment variables’. Here is a copy of mine:
# Load mod_jk module LoadModule jk_module "/Applications/ColdFusion10/config/wsconfig/1/mod_jk.so" # Where to find workers.properties JkWorkersFile "/Applications/ColdFusion10/config/wsconfig/1/workers.properties" JkMountFile "/Applications/ColdFusion10/config/wsconfig/1/uriworkermap.properties" # Where to put jk logs JkLogFile "/Applications/ColdFusion10/config/wsconfig/1/mod_jk.log" # custom environment variables JkEnvVar REDIRECT_URL JkEnvVar REDIRECT_REMOTE_HOST JkEnvVar REDIRECT_PATH JkEnvVar REDIRECT_QUERY_STRING JkEnvVar REDIRECT_HTTP_ACCEPT JkEnvVar REDIRECT_HTTP_USER_AGENT JkEnvVar REDIRECT_REMOTE_ADDR JkEnvVar REDIRECT_SERVER_NAME JkEnvVar REDIRECT_SERVER_PORT JkEnvVar REDIRECT_SERVER_SOFTWARE # Where to put jk shared memory JkShmFile "/Applications/ColdFusion10/config/wsconfig/1/jk_shm" # Set the jk log level [debug/error/info] JkLogLevel info # Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf Alias /CFIDE "/Applications/ColdFusion10/cfusion/wwwroot/CFIDE" <directory "="" applications="" <span="" class="hiddenSpellError" pre="">ColdFusion10/cfusion/wwwroot/CFIDE"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all Order allow,deny Deny from all
Let’s fire things up and see what happens! In terminal window:
cd /Applications/ColdFusion10/cfusion/bin ./coldfusion start sudo apachectl start
Try going to your ColdFusion administrator or any other CF page
If nothing is coming up in your browser window, here are a few things to try. In a terminal window:
sudo apachectl -t
This verifies the syntax of your Apache config files and will tell you if something is wrong. Apache ok? can you browse just ‘localhost’ ? If your syntax is ok and you can hit localhost and see the “It works!”, then perhaps its a CF issue.
Take a look at:
That log should give you a clue what else may be going on with CF10 if it’s not running right. One common thing I can think of, if you did not reinstall ColdFusion then perhaps Mavericks reset the folder permissions on either the /CFIDE or your directory where your code may be.
Don’t forget to vote for the bug so Adobe themselves fix this problem. You can do that at the link at the top of this article. Also, if your ColdFusion is now working, take a moment to create a CAR file of your settings so you have it handy.
I said this before in my previous post, but it bars repeating here too:
Don’t forget to do the ColdFusion 10 mandatory update so you can continue doing the rest of the ColdFusion 10 server updates.
Also, a word of caution – as you start installing the CF10 server updates through the admin, you may be tempted to try and re-configure the Apache connector because almost every one of those updates instructs you to do that. DON’T! You’d be replacing the mod_jk.so file with one that currently doesn’t work.
Prepare yourself to perhaps repeat all these steps again as pressure mounts on the ColdFusion team to fix this bug. That means a new CF10 installer, and/or a hotfix of some kind.