Minor Railo 3 / MySQL / Mango Blog gotcha

>> Monday, 9 March 2009

I've been meaning to give Mango blog a whirl for a while now and as I'd just been given some server space by my pal Mark Drew (twitter:@Markdrew) for one of my pet projects I thought why not so this weekend I tasked myself with getting it up and running.

Now I have to say first and foremost I love the way Mango is installed. It's nice to see a CF app give as much care and attention to the install process as some of the bigger OSS apps from the PHP arena (Drupal, Joomla, Wordpress etc.) just unzip, upload and browse to the document root to view the installer.... perfect.

However after the hassle-free installation I immediately ran into a problem when trying to view the frontend site that left me scratching my head somewhat. the error message was...

"Can't cast String [] to a value of type [Array] Java type of the object is java.lang.String"
Nice and generic eh? Well I muddled about trying various things such as uninstalling and re-installing it to the webroot instead of a sub folder, installing it without using a prefix on the db tables. nothing seemed to work. I then consulted Google looking for an answer and found a similiar problem posted up on the Mango blog forums that suggested it may be an issue with the data in the db table concerning links. So I checked there and found nothing amiss and by this point I was at a total loss what to do.

Luckily for me James Buckingham (twitter: clarkee21) was experiencing the exact same problem when attempting to install Mango Blog on Railo 3 using MySQL as well. We exchanged a few messages back and forth last night about the problem and then I eventually gave up and went to bed. However James contacted the extremely helpful and lovely Gert Franz (twitter: Gert_Railo) from Railo and between them tried some bits but it was Laura Arguello who came up with the suggestion that it was down to a setting in the Railo datasources configuration section concerning the preservation of single quotes within the cfquery tag in the Mango Blog support forum here.

A quick trip to the datasource page under services in the Railo web administration panel to uncheck the box marked 'Preserve single quotes' and presto! all was now working.

I thought I'd mention this on the blog so people can find the solution if they do a search as I struggled to find anything pertinent when I attempted to do so.

It is also worthwhile to note that this setting affects ALL datasources in your context.

If you experience similiar problems when running your own code then you can also programatically set this option for each query by adding the following option to your cfquery tags
<cfquery psq="true">
Hopefully this post will be of use to someone as it would be a shame for someone to hit this minor stumbling block and swear off either Railo or Mango blog because of it as they're both pretty damn great if you ask me.

until next time...
À bientôt


kingdoms 9 March 2009 at 14:33  

Good sleuth work! I had the same problem and eventually "fixed" it by just installing Mango 1.24 which doesn't appear to suffer the same problem. I might see if I can get the latest up and running this evening - you have beer credit with me!

Ciqala 9 March 2009 at 14:42  

no worries. I'm really just repeating what the other guys found but hopefully it'll fix your problem too.

I'll still take that beer though, haha :)

James 9 March 2009 at 19:58  

Glad it helped dude.

I can't take the credit though as it was Laura Arguello who helped me out here:- http://www.mangoblog.org/forums/messages.cfm?threadid=B0357463-3048-2A53-706A65B6205D6A09

Gert suggestioned the psq=true approach but I'm not sure as that forks my code from the original Mango. So it could be a pain for upgrades.

I've deselected the SPQ in the admin for now but hopefully that doesn't affect my other projects. We'll see :-).


Ciqala 10 March 2009 at 01:59  

ahh ok. I'll update my post to credit Laura then.

also the psq="true" was meant more of a general "if you have a similiar problem then you can also try this approach" rather than a solution to the problem at hand. I wrote the post in a rush at the end of my lunch break so I didn't go over it as much as i'd have liked. I'll update it to be a bit clearer now.