With a little side of applesauce...

Monday, January 12, 2009

Coldfusion - init() with arguments, and "this" scope

Ok, I'm not sure why this is, but if I invoke an init() function for my Logger.cfc, my local methods need to be explicitly called with "this":
<cfset cfcLog = createObject("component",".Logger").init("workflow")>
<cfset cfcLog.logger( "this is an error" )>


Here is the error:
Entity has incorrect type for being called as a function.

The symbol you provided file is not the name of a function.


Here is the original function:
<cfcomponent name="Logger" ...    
<cffunction name="logger"
returnType="void"
access="public"
output="no"
hint="log an entry to a log file, send email, or both
@param message string required text of log entry
@param logType string information/warning/error/fatal (default information)
@param action string file/mail/all (log to file, send mail, or both log and send email) (default file)
">
<cfargument name="message" type="string" required="yes">
<cfargument name="logType" type="string" default="Information">
<cfargument name="action" type="string" default="file">

<cfswitch expression = "#action#">
<cfcase value="file">
<cfset file( message, logType )>
</cfcase>

...


And, here is the fix:
<cfcomponent name="Logger" ...    
<cffunction name="logger"
returnType="void"
access="public"
output="no"
hint="log an entry to a log file, send email, or both
@param message string required text of log entry
@param logType string information/warning/error/fatal (default information)
@param action string file/mail/all (log to file, send mail, or both log and send email) (default file)
">
<cfargument name="message" type="string" required="yes">
<cfargument name="logType" type="string" default="Information">
<cfargument name="action" type="string" default="file">

<cfswitch expression = "#action#">
<cfcase value="file">
<cfset this.file( message, logType )>
</cfcase>

...

Tuesday, January 6, 2009

Coldfusion - Ok, you can't overload functions

Now I believe you:
500

ROOT CAUSE:
java.lang.StackOverflowError
at java.util.HashMap.put(HashMap.java:372)
at coldfusion.runtime.LocalScope.bindInternal(LocalScope.java:373)
at coldfusion.runtime.LocalScope.bindInternal(LocalScope.java:387)
at cfLdap2ecfc237833483$funcADD.runFunction(/home/speeves/workspace/workflow/class/Workflow/Ldap.cfc:99)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)

Monday, January 5, 2009

Coldfusion - Linux bin file is really just a zip file

I should have figured this, but the bin format that Adobe distributes Linux Coldfusion is just a zip file, which makes it nice for seeing if the ApacheBuildInstructions.txt was updated in version 8.01. Here was how I did it:

cd /path/to/coldfusion-8.01-lin.bin
unzip coldfusion-801-lin.bin
grep -r -i "wsconfig.jar" Z_/
Binary file Z_/installers/sources/Core J2EE Server_zg_ia_sf.jar matches

cd Z_/installers/sources/
unzip Core\ J2EE\ Server_zg_ia_sf.jar
cd runtime/lib/
unzip wsconfig.jar
cd connectors/src/
less ApacheBuildInstructions.txt


Coldfusion - wishform...

Adobe doesn't have an official bug tracker for external users to submit bugs for Coldfusion, (ala http://bugs.adobe.com ), but does have a wishform, which apparently doubles as a bug submission page. Perhaps, we should submit a wish for a better bug support interface?

Coldfusion 8 / Apache - compiling instructions wrong in ApacheBuildInstructions.txt

I had a request for a sample build_jrun22.sh, (which must have existed at some point, but Adobe has discontinued supporting), so I wanted to post the updated instructions here, (where they would be more legible), as opposed to a follow-up comment.

They now include the instructions and source inside wsconfig.jar, (which is just a zip file). Here is how I would perform the build:

cp /path/to/coldfusion8/runtime/lib/wsconfig.jar /tmp
cd /tmp
unzip wsconfig.jar
cd connectors/src/

sudo apt-get install apache2-dev (which contains apxs2, if you are on Debian/Ubuntu)


Here are the updated build commands:
/usr/bin/apxs2 -n jrun22 -c mod_jrun22.c jrun_maptable_impl.c jrun_property.c jrun_session.c platform.c jrun_mutex.c jrun_proxy.c  jrun_utils.c
sudo /usr/bin/apxs2 -i -n jrun22 -S LIBEXECDIR=/path/to/coldfusion8/runtime/lib/wsconfig/1/ mod_jrun22.la
cd /path/to/coldfusion8/runtime/lib/wsconfig/1/
sudo strip mod_jrun22.so
sudo /etc/init.d/apache2 restart


Once you have restarted Apache, you should see something like this in the Apache error.log, (notice the updated build timestamp for the JRun 4.0 module):

[Mon Jan 05 10:13:46 2009] [notice] jrApache[init]  JRun 4.0 (Build 108673) Apache 2.2 module - Jan  5 2009 10:11:00
[Mon Jan 05 10:13:46 2009] [notice] jrApache[init] JRun 4.0 (Build 108673) Apache 2.2 module - Jan 5 2009 10:11:00
[Mon Jan 05 10:13:46 2009] [notice] Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4 with Suhosin-Patch JRun/4.0 configured -- resuming normal operations



I have verified that ApacheBuildInstructions.txt hasn't been updated in 8.01, and will submit a patch to Adobe to update the changes.