groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Eldridge (JIRA)" <>
Subject [jira] [Commented] (GROOVY-3356) Groovy incompatible with 3rd party XML DOM parsers
Date Fri, 03 Feb 2017 12:43:51 GMT


Christopher Eldridge commented on GROOVY-3356:

This still appears to be an issue. I'm using Groovy 2.4.7 with HtmlUnit 2.24 and am getting
this error. I can't remove the offending jar (xml-apis-1.4.01) because I still need some of
the classes that are in there (I get ClassDefNotFoundError messages if I remove it). Since
this seems to have been a problem for some time now does it make sense to remove the lines
of code that are causing this? From the comments it appears it's doing the opposite of what
it was intended for. 

> Groovy incompatible with 3rd party XML DOM parsers
> --------------------------------------------------
>                 Key: GROOVY-3356
>                 URL:
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk, XML Processing
>    Affects Versions: 1.6-rc-3, 2.4.3
>         Environment: Groovy 1.6.0 RC3, Java 1.6.0_10 
>            Reporter: John Hurst
>            Priority: Minor
> With Groovy versions 1.5.7 onwards there is a problem where Groovy loads
> DOM classes from the Java SDK in its RootLoader constructor.
> This makes it incompatible with XML parsing libraries having different
> versions of DOM interfaces.  For example, with Oracle XML Parser I get:
> Caught: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>)
previously initiated loading for a different type with name "org/w3c/dom/NamedNodeMap"
> $groovy -e "println javax.xml.parsers.DocumentBuilderFactory.newInstance().getClass()"
> class oracle.xml.jaxp.JXDocumentBuilderFactory
> $jar tvf ~/.groovy/lib/xmlparserv2- |grep "org/w3c/dom/NamedNodeMap"
>    581 Tue Dec 23 12:53:38 NZDT 2003 org/w3c/dom/NamedNodeMap.class
> $jar tvf $JAVA_HOME/jre/lib/rt.jar |grep "org/w3c/dom/NamedNodeMap"
>    566 Fri Sep 26 01:22:26 NZST 2008 org/w3c/dom/NamedNodeMap.class
> This is caused by change r12189, comment:
>   adds a special hack for org.w3c.dom.Node, to avoid violation of class loader constraints
> The troublesome lines are:
>   // major hack here...!
>   try{
>       customClasses.put("org.w3c.dom.Node",super.loadClass("org.w3c.dom.Node",false));
>   } catch (Exception e) {}
> If I undo this change in trunk, I get a version of Groovy which works happily
> with the Oracle XML Parser.
> For what it's worth, I need to use the Oracle XML Parser because it contains
> code required by the Oracle XDK, required to use Oracle XML functionality in
> the JDBC driver.

This message was sent by Atlassian JIRA

View raw message