Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.6-rc-3, 2.4.3
-
None
-
None
-
Groovy 1.6.0 RC3, Java 1.6.0_10
Description
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-10.2.0.2.0.jar |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
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.