Recently, when writing a test script in Groovy, a problem occurs. In Groovy 1.5.7, groovy reads a built-in dom Processing Package (org. w3c. dom), and groovy script used in the watij library contains the xml-apis.jar conflict, because the version is not the same.
The following error is reported:
Caught: java. lang. LinkageError: loader constraint violation: loader (instance of <bootloader>) previviusly initiated loading for a different type with name "org/w3c/dom/NamedNodeMap"
After checking the information on the Internet for a long time, I finally found http://jira.codehaus.org/browse/policy-3356. I found that it was originally a groovy bug. The current status of this bug is open. The related description of this bug:
With Groovy versions 1.5.7 onwards there is a problem where Groovy loadsDOM classes from the Java SDK in its RootLoader constructor. This makes it incompatible with XML parsing libraries having differentversions of DOM interfaces. For example, with Oracle XML Parser I get:
Since it has not been fixed yet, I tried to return to groovy 1.5.6. Well, no error is reported. It seems that it is a problem of 5.7.
Forget it. Use 1.5.6 first. The difference is not big.
If any expert can find a better solution, please do not hesitate to give me some advice!