Monday, February 23, 2009

Source code in blogger posts.

UPDATE: I am pleased to tell you that I have just installed the Groovy syntaxhighlighter from the trunk of that project.

I am glad I finally found a solution to my problem. I think the guys at blogger need to write up something in their FAQs about having source code in blog posts. Most of the Google searches I undertook came out with nothing until I found this gem.

I am hoping to find some form of blogger plugin that does this in the future, like what the WordPress guys have done. I will also be hoping that the syntaxhighlighter guys will provide Groovy support soon ;)

More later.

Thursday, February 19, 2009

Oracle XMLParser and Grails - Lessons learnt

A few days ago I was trying to integrate the work of a colleague into a light Grails application I am currently maintaining but experienced classpath hell with Oracle's XMLParser V2. A better description of the problem can be found in the JIRA for the Grails project here.

The steps prescribed didn't seem to work so I thought I'd do some digging again. I'll disappoint you by telling you that the JIRA issue remains unresolved and I was only able to come up with a work around. I looked into the script for RunWar and it would appear that for some reason, Grails defaults to a non-validating parser before kicking off Jetty.

The following lines in the RunWar.groovy script for Grails-1.0.3 is telling:

System.setProperty('org.mortbay.xml.XmlParser.NotValidating','true')


This single line of code ensures that you use a non-validating parser to start up Jetty and parse your application's web.xml. Maybe if there was another means for configuring your xml parsing for Jetty in Grails it would solve the problem.

I also tried other hacky things like replacing the SAXParserFactory as suggested here but that didn't work. In the meantime I have had to make do with refactoring my classes so that they don't exchange data of xmlType directly with the database. For now Strings/Clobs will suffice until I can find an unobtrusive way of starting Jetty from Grails that will condone Oracle's XmlParser on the classpath.

Your suggestions are very welcome.