Thursday, July 29, 2010

Grails LinkageError for SAXParseException

I ran "grails run-app" for the app that I've been working on and was greeted with the following :

java.lang.LinkageError: loader constraint violation: loader (instance of <bootlo
ader>) previously initiated loading for a different type with name "org/xml/sax/
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(
at java.lang.Class.getDeclaredMethods(
at Method)
at org.codehaus.groovy.util.LazyReference.getLocked(
at org.codehaus.groovy.util.LazyReference.get(
at grails.util.PluginBuildSettings.getPluginInfos(
at grails.util.PluginBuildSettings.getPluginInfos(
at grails.util.PluginBuildSettings$getPluginInfos.callCurrent(Unknown So
at grails.util.PluginBuildSettings.getPluginInfo(PluginBuildSettings.gro
at grails.util.PluginBuildSettings$getPluginInfo.callCurrent(Unknown Sou
at grails.util.PluginBuildSettings.getPluginInfoForSource(PluginBuildSet
at org.codehaus.groovy.transform.ASTTransformationVisitor$
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(Compil
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(Compilat
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(Co
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.j
at _GrailsEvents_groovy$ Source)
at _GrailsClean_groovy$ Source)
at _GrailsClean_groovy$ Source)
at _GrailsPlugins_groovy$ Source)
at _GrailsRun_groovy$ Source)
at _GrailsRun_groovy$ Source)
at RunApp$ Source)
at gant.Gant.prepareTargets(Gant.groovy:606)
Error loading event script from file [PATH_TO_GRAILS\.grails
oovy] loader constraint violation: loader (instance of <bootloader>) previously
initiated loading for a different type with name "org/xml/sax/SAXParseException"

Grails had done some sort of update that I didn't pay a lot of attention to. I wondered if this had something to do with the update and will have to find out what went on later.

I found an entry on the Grails Jira dealing with the problem of xerces and Java 6. The suggested solution was to remove xml-apis-1.0.2.b2.jar.

I ran :
find . -name "*xml*"
find . -name "*api*"
from my project directory, my .grails directory and my .ivy directory. I found xml-apis-1.3.04.jar in my .ivy directory.

I ran jarscan against my project directory, .grails directory and .ivy directory and found 0 hits for SAXParseException.

I added :

    inherits("global") {
excludes "xml-apis"

To my BuildConfig.groovy file just below dependencies. The app ran.

Saturday, July 17, 2010

Changing form actions with jQuery

I'm working on a simple cms in a side project. Naturally I have a page where administrators can create new web pages.

I'm using the jQuery version of TinyMCE for editing. It is worth a look if you need wysiwyg textarea editing.

I wanted to give my client the ability to preview the page before saving it. The solution was simple: change the form's action in the click handler.

The implementation eluded me for a while; although, it was completely obvious:
$("#create_page_form").attr( "action", "/preview_page" );

$("#create_page_form").attr( "action", "/create_page" );

"#preview" and "#submit" are the ids of two links but could be buttons.

I thought I would post it in the event that anyone else Google's "jQuery change form action."

Tuesday, July 13, 2010


No matter what text editor I'm in I can't help but typing "SHIFT :" followed by "q".

Does that happen to anyone else?