0
votes

I have a Geoscript library that reads uploaded shapefiles and then converts it to WKT. This works when I upload the library to the lib directory, but when I pull it in from Maven, I get a sax clash. Does anyone know of a solution?

This is the error

| Error Error executing script Clean: loader constraint violation: when resolving overridden method "org.apache.tools.ant.helper.ProjectHelper2$RootHandler.setDocumentLocator(Lorg/xml/sax/Locator;)V" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/apache/tools/ant/helper/ProjectHelper2$RootHandler, and its superclass loader (instance of ), have different Class objects for the type andler.setDocumentLocator(Lorg/xml/sax/Locator;)V used in the signature (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)

1

1 Answers

2
votes

This is manifested by a Grails bug, namely GRAILS-9331. You should be able to exclude the offending libraries, but Grails ignores this. The Grails fix, not yet available, actually doesn't appear to fix this, it merely ignores org.xml when class loading. This is an indirect fix and appears to still misload the xml-apis library. The ideal fix would be:

       compile ('org.geoscript:geoscript-groovy:1.0-SNAPSHOT') {
           excludes "xml-apis","xml-apis-ext","xercesImpl","xalan"
       }

The Grails bug prevents this from working. I loaded the excludes list and dependency into Gradle and generated the dependency list for 1.0-SNAPSHOT. This whitelist can be used in lieu of 'org.geoscript:geoscript-groovy:1.0-SNAPSHOT'

        compile("bouncycastle:bcmail-jdk14:138",
            "bouncycastle:bcprov-jdk14:138",
            "bouncycastle:bctsp-jdk14:138",
            "com.googlecode.json-simple:json-simple:1.1",
            "com.h2database:h2:1.1.119",
            "com.lowagie:itext:2.1.7",
            "com.miglayout:miglayout:3.7",
            "com.vividsolutions:jts:1.12",
            "commons-collections:commons-collections:3.2.1",
            "commons-dbcp:commons-dbcp:1.3",
            "commons-io:commons-io:2.0.1",
            "commons-jxpath:commons-jxpath:1.3",
            "commons-logging:commons-logging:1.1.1",
            "commons-pool:commons-pool:1.5.4",
            "hsqldb:hsqldb:1.8.0.10",
            "it.geosolutions.imageio-ext:imageio-ext-tiff:1.1.5",
            "it.geosolutions.imageio-ext:imageio-ext-utilities:1.1.5",
            "java3d:vecmath:1.3.2",
            "javax.media:jai_codec:1.1.3",
            "javax.media:jai_core:1.1.3",
            "javax.media:jai_imageio:1.1",
            "jdom:jdom:1.0",
            "jfree:eastwood:1.1.1-20090908",
            "jfree:jcommon:1.0.13",
            "jfree:jfreechart:1.0.10",
            "jgridshift:jgridshift:1.0",
            "junit:junit:4.5",
            "mysql:mysql-connector-java:5.1.17",
            "net.java.dev.jsr-275:jsr-275:1.0-beta-2",
            "net.sf.opencsv:opencsv:2.0",
            "net.sourceforge.hatbox:hatbox:1.0.b7"
    ) {
        transitive = false
    }
    compile("org.apache.avalon.framework:avalon-framework-api:4.3.1",
            "org.apache.avalon.framework:avalon-framework-impl:4.3.1",
            "org.apache.xmlgraphics:batik-anim:1.7",
            "org.apache.xmlgraphics:batik-awt-util:1.7",
            "org.apache.xmlgraphics:batik-bridge:1.7",
            "org.apache.xmlgraphics:batik-css:1.7",
            "org.apache.xmlgraphics:batik-dom:1.7",
            "org.apache.xmlgraphics:batik-ext:1.7",
            "org.apache.xmlgraphics:batik-gvt:1.7",
            "org.apache.xmlgraphics:batik-js:1.7",
            "org.apache.xmlgraphics:batik-parser:1.7",
            "org.apache.xmlgraphics:batik-script:1.7",
            "org.apache.xmlgraphics:batik-svg-dom:1.7",
            "org.apache.xmlgraphics:batik-svggen:1.7",
            "org.apache.xmlgraphics:batik-transcoder:1.7",
            "org.apache.xmlgraphics:batik-util:1.7",
            "org.apache.xmlgraphics:batik-xml:1.7",
            "org.apache.xmlgraphics:fop:0.94",
            "org.apache.xmlgraphics:xmlgraphics-commons:1.2",
            "org.bouncycastle:bcmail-jdk14:1.38",
            "org.bouncycastle:bcprov-jdk14:1.38",
            "org.bouncycastle:bctsp-jdk14:1.38",
            "org.eclipse.emf:common:2.6.0",
            "org.eclipse.emf:ecore:2.6.1",
            "org.eclipse.xsd:xsd:2.6.0",
            "org.geoscript:geocss_2.9.1:0.7.4",
            "org.geoscript:geoscript-groovy:1.0-SNAPSHOT",
            "org.geotools.jdbc:gt-jdbc-h2:8.4",
            "org.geotools.jdbc:gt-jdbc-mysql:8.4",
            "org.geotools.jdbc:gt-jdbc-postgis:8.4",
            "org.geotools.jdbc:gt-jdbc-spatialite:8.4"
    ) {
        transitive = false
    }
    compile("org.geotools.ogc:net.opengis.fes:8.4",
            "org.geotools.ogc:net.opengis.ows:8.4",
            "org.geotools.ogc:net.opengis.wfs:8.4",
            "org.geotools.ogc:org.w3.xlink:8.4",
            "org.geotools.xsd:gt-xsd-core:8.4",
            "org.geotools.xsd:gt-xsd-fes:8.4",
            "org.geotools.xsd:gt-xsd-filter:8.4",
            "org.geotools.xsd:gt-xsd-gml2:8.4",
            "org.geotools.xsd:gt-xsd-gml3:8.4",
            "org.geotools.xsd:gt-xsd-ows:8.4",
            "org.geotools.xsd:gt-xsd-wfs:8.4",
            "org.geotools:gt-api:8.4",
            "org.geotools:gt-brewer:8.4",
            "org.geotools:gt-charts:8.4",
            "org.geotools:gt-coverage:8.4",
            "org.geotools:gt-cql:8.4",
            "org.geotools:gt-data:8.4",
            "org.geotools:gt-epsg-hsql:8.4",
            "org.geotools:gt-geojson:8.4",
            "org.geotools:gt-graph:8.4",
            "org.geotools:gt-grid:8.4",
            "org.geotools:gt-jdbc:8.4",
            "org.geotools:gt-main:8.4",
            "org.geotools:gt-metadata:8.4",
            "org.geotools:gt-opengis:8.4",
            "org.geotools:gt-process-feature:8.4",
            "org.geotools:gt-process-geometry:8.4",
            "org.geotools:gt-process:8.4",
            "org.geotools:gt-property:8.4",
            "org.geotools:gt-referencing:8.4",
            "org.geotools:gt-render:8.4"
    ) {
        transitive = false
    }
    compile("org.geotools:gt-shapefile:8.4",
            "org.geotools:gt-svg:8.4",
            "org.geotools:gt-swing:8.4",
            "org.jaitools:jt-utils:1.3.0",
            "org.jaitools:jt-zonalstats:1.3.0",
            "org.json:json:20090211",
            "org.opengeo:geodb:0.7-RC2",
            "org.scala-lang:scala-library:2.9.1",
            "picocontainer:picocontainer:1.2",
            "postgresql:postgresql:8.4-701.jdbc3"
    ) {
        transitive = false
    }

Very verbose, but will operate correctly in Grails 2.1.0