Reconfigure Apache Connector on Mac, Mountain Lion & CF10

ColdFusion 10 server updates
ColdFusion 10 server updates
ColdFusion 10 server updates informs to reconfigure connectors using wsconfig tool.

I’ve had to dabble through a few updates of ColdFusion 10 so far, and I’ve noticed that some of the updates require reconfiguring the Apache connector.  Something I hadn’t done before in CF9.  The main reason I had discovered this and needed it was the bug fixes in update # 1 that managed to fix problems with CGI variables.  I needed access to cgi.redirect_url and cgi.redirect_uri since I’m using Mod_rewrite rules for my urls.

For starters, you have to manually remove the Apache connector.  If you try to reconfigure right off the bat, you’ll be told that “This web server is already configured for ColdFusion.”

To get started, do yourself a favor and stop both Apache & ColdFusion 10.

For Apache, in a terminal window (I like iTerm), enter:

sudo apachectl stop

For ColdFusion 10, in a terminal window (if single server install) enter:

cd /Applications/ColdFusion10/cfusion/bin

./coldfusion stop

Here are the manual steps from the Adobe article on Installation Considerations:

  • If ColdFusion uninstaller is not able to remove the connector for Apache (for example, in the case of Mac OS X), do the following to manually remove it:
    1. Delete the mod_jk.conf found in
      {apache_install_location}/conf/directory.
    2. Delete {cfroot}/config/wsconfig/1folder which has the Apache connector file,
      mod_jk.so.
    3. Remove the following line from {apache_install_location}/conf/httpd.conf file:
      Include “{apache_install_location}\conf\mod_jk.conf”.
    4. Delete the file {apache_install_location}\conf\mod_jk.conf

You can faithfully follow the above steps, but know that #4 is the same as #1.  Also, # 2 – I’ve noticed for myself that my /config/wsconfig/ directory contains two files, a wsconfig.log and wsconfig.properties files.  If I leave those files there and try to run the steps to reconfigure Apache, I’m still told “This server is already configured for ColdFusion.”  If you get this error, do yourself a favor and just delete the entire “wsconfig” directory and the included two files.  The Apache connector will recreate the folder & files.

To reconfigure Apache, in a terminal window type (again, if you are doing single server install – and chose default locations):

cd /Applications/ColdFusion10/cfusion/runtime/bin

sudo ./wsconfig -ws Apache -dir /etc/apache2 -v

You’ll be prompted for your account password.  Wsconfig needs additional privileges to create folders & files in protected directories.  If you try to execute without it you’ll get some strange “java.io.FileNotfoundException” type of errors for each file/folder it tries to create.  My command above is also assuming you’re using the default Apache located in /etc/apache2.  If you are using a different version of Apache, or installed Apache after the fact in a different location, then please update that part of the directory path.

Here is what you should likely see once the wsconfig is running:


command line: -ws Apache -dir /etc/apache2 -v
Could not find file /private/etc/bin/httpd
Using Apache binary /usr/sbin/httpd
Server version: Apache/2.2.22 (Unix)
Could not find file /private/etc/bin/apachectl
Using Apache control script /usr/sbin/apachectl
Parsing Apache configuration file /private/etc/apache2/httpd.conf
Exec'ing chmod 777 /Applications/ColdFusion10/config/wsconfig/1
Set permission to 777 on /Applications/ColdFusion10/config/wsconfig/1
Exec'ing chmod +x /Applications/ColdFusion10/config/wsconfig/1/mod_jk.so
Set permission to execute on /Applications/ColdFusion10/config/wsconfig/1/mod_jk.so
Created file /Applications/ColdFusion10/config/wsconfig/1/mod_jk.so
Wrote file /private/etc/apache2/httpd.conf
Added ColdFusion configuration to Apache configuration file /private/etc/apache2/httpd.conf
Created file /Applications/ColdFusion10/config/wsconfig/1/README.txt
Wrote file /Applications/ColdFusion10/config/wsconfig/wsconfig.properties
Exec'ing /usr/sbin/apachectl restart
Restarted Apache server
The Apache connector was installed to /private/etc/apache2

Congrats, you’ve reconfigured the Apache connector on your Mac.  Apache got restarted with this process.  Don’t forget to restart ColdFusion:

cd /Applications/ColdFusion10/cfusion/bin

./coldfusion start

You’re done!

ColdFusion 10 broken xmlSearch()

Ever since I upgraded to ColdFusion 10 I’m discovering a lot of little “gotchas”.  Today’s seems to be a change / bug in backwards compatibility of xmlSearch().  ColdFusion 10 added support for XPath 2.0 which adds a lot of great new features I really haven’t played with yet.  However, it seems like some things from XPath 1.0 are no longer supported, or just left out of compatibility.

Here is an example.  I have a modified Amazon S3 CFC wrapper service that I use.  It’s first function that gets xmlSearch() use is a call to “getBuckets”.

Here is the xml being returned:

<xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <Owner>
        <ID>123456789(hidden)</ID>
        <DisplayName>devPlayground</DisplayName>
    </Owner>
    <Buckets>
        <Bucket>
            <Name>myDevBucket</Name>
            2012-07-11T00:22:33.000Z
        </Bucket>
        <Bucket>
            <Name>myProdBucket</Name>
            2012-07-23T17:23:40.000Z
        </Bucket>
    </Buckets>
</ListAllMyBucketsResult>

This search used to work, but it doesn’t now:

local.buckets = xmlSearch(local.apiCall.response, "//:Bucket");

The above search now throws a dreaded “XMLSearch for Unexpected colon at start of token” error.  The namespace didn’t change and this colon was an alias to the namespace as I understand it.

After some searching, I found the answer I needed (as usual) on stackoverflow.

Here is the revised and working xmlSearch():

local.buckets = xmlSearch(local.apiCall.response, "//*[local-name()='Bucket' and namespace-uri()='http://s3.amazonaws.com/doc/2006-03-01/']");

I have a lot of xmlSearch() to fix now..

ColdFusion 10 + CFBuilder 2.0.1 + RDS and a little Apache Issue

If you are running ColdFusion 10 + CFBuilder 2.01 + RDS and you’re using Apache locally (I’m on a mac) you get these strange errors reported when trying to establish an RDS connection:

RDS server message: could not initialize class com.adobe.rds.core.services.Messages

Adding this one line to your Virtual Host file setting fixes the problem, and it worked for my localhost setting:

JkMountFile “/Applications/ColdFusion10/config/wsconfig/1/uriworkermap.properties”

JkMountFile is a Tomcat directive.  To quote from Tomcat’s uriworkermap connectors:

“For Apache you can define individual uriworkermap files per virtual host. The directive JkMountFile can be used in the main server and in each virtual host. If a virtual host does not use JkMountfile, but JkMountCopy is set to ‘On’, then it inherits the JkMountFile from the main server. If you want all vhost to inherit mounts from the main server, you can set JkMountCopy to ‘All’ in the main server.”

Holy crap this has been annoying me.  A super big thank you to for this blog post:

http://www.giancarlogomez.com/2012/03/coldfusion-10-cfbuilder-201-rds-and.html