java.lang.LinkageError Groovy 2.4.14 apache poi 3.17 jdk 1.8.0_92 http-builder 0.7.1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java.lang.LinkageError Groovy 2.4.14 apache poi 3.17 jdk 1.8.0_92 http-builder 0.7.1相关的知识,希望对你有一定的参考价值。

尝试从inputstream打开Excel文件时(Groovy 2.4.14 apache poi 3.17 jdk 1.8.0_92):

def myWorkBook = new XSSFWorkbook(zis)

我收到了错误:

Caught: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.xerces.dom.NodeImpl.getChildNodes()Lorg/w3c/dom/NodeList;" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, org/apache/xerces/dom/NodeImpl, and the class loader (instance of <bootloader>) for interface org/w3c/dom/Node have different Class objects for the type org/w3c/dom/NodeList used in the signature
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.xerces.dom.NodeImpl.getChildNodes()Lorg/w3c/dom/NodeList;" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, org/apache/xerces/dom/NodeImpl, and the class loader (instance of <bootloader>) for interface org/w3c/dom/Node have different Class objects for the type org/w3c/dom/NodeList used in the signature
    at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.apache.poi.util.DocumentHelper.readDocument(DocumentHelper.java:140)
    at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:374)
    at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:100)
    at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(ZipContentTypeManager.java:54)
    at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:253)
    at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:756)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:327)
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:295)

我的类路径:

--classpath .;C:ProjectHWJudeaPWYR_Cyfro	argetclasses;C:ProjectHWJudeaPWYR_Cyfrolibjira-client-0.5.jar;C:ProjectHWJudeaPWYR_Cyfrolibhttpclient-4.2.5.jar;C:ProjectHWJudeaPWYR_Cyfrolibhttpcore-4.2.4.jar;C:ProjectHWJudeaPWYR_Cyfrolibcommons-logging-1.1.1.jar;C:ProjectHWJudeaPWYR_Cyfrolibcommons-codec-1.6.jar;C:ProjectHWJudeaPWYR_Cyfrolibhttpmime-4.2.5.jar;C:ProjectHWJudeaPWYR_Cyfrolibjson-lib-2.4-jdk15.jar;C:ProjectHWJudeaPWYR_Cyfrolibcommons-beanutils-1.8.0.jar;C:ProjectHWJudeaPWYR_Cyfrolibcommons-collections-3.2.1.jar;C:ProjectHWJudeaPWYR_Cyfrolibcommons-lang-2.5.jar;C:ProjectHWJudeaPWYR_Cyfrolibezmorph-1.0.6.jar;C:ProjectHWJudeaPWYR_Cyfrolibjoda-time-2.3.jar;C:ProjectHWJudeaPWYR_Cyfrolibjunit-4.8.2.jar;C:ProjectHWJudeaPWYR_Cyfrolibmockito-all-1.9.0.jar;C:ProjectHWJudeaPWYR_Cyfrolibcommons-httpclient-3.1.jar;C:ProjectHWJudeaPWYR_Cyfrolibcommons-io-2.5.jar;C:Usersdev.m2
epositoryorgcodehausgroovymoduleshttp-builderhttp-builder.7.1http-builder-0.7.1.jar;C:Usersdev.m2
epositoryorgapachehttpcomponentshttpclient4.2.1httpclient-4.2.1.jar;C:Usersdev.m2
epositoryorgapachehttpcomponentshttpcore4.2.1httpcore-4.2.1.jar;C:Usersdev.m2
epositorycommons-loggingcommons-logging1.1.1commons-logging-1.1.1.jar;C:Usersdev.m2
epositorycommons-codeccommons-codec1.6commons-codec-1.6.jar;C:Usersdev.m2
epository
etsfjson-libjson-lib2.3json-lib-2.3-jdk15.jar;C:Usersdev.m2
epositorycommons-beanutilscommons-beanutils1.8.0commons-beanutils-1.8.0.jar;C:Usersdev.m2
epositorycommons-collectionscommons-collections3.2.1commons-collections-3.2.1.jar;C:Usersdev.m2
epositorycommons-langcommons-lang2.4commons-lang-2.4.jar;C:Usersdev.m2
epository
etsfezmorphezmorph1.0.6ezmorph-1.0.6.jar;C:Usersdev.m2
epository
etsourceforge
ekohtml
ekohtml1.9.16
ekohtml-1.9.16.jar;C:Usersdev.m2
epositoryxercesxercesImpl2.9.1xercesImpl-2.9.1.jar;C:Usersdev.m2
epositoryxml-apisxml-apis1.3.04xml-apis-1.3.04.jar;C:Usersdev.m2
epositoryxml-resolverxml-resolver1.2xml-resolver-1.2.jar;C:ProjectHWJudeaPWYR_Cyfrolibeaapi.jar;C:ProjectHWJudeaPWYR_Cyfrolibjacob.jar;C:utilsgroovy-2.4.14libant-1.9.4.jar;C:utilsgroovy-2.4.14libant-antlr-1.9.4.jar;C:utilsgroovy-2.4.14libant-junit-1.9.4.jar;C:utilsgroovy-2.4.14libant-launcher-1.9.4.jar;C:utilsgroovy-2.4.14libsf-2.4.0.jar;C:utilsgroovy-2.4.14libcommons-cli-1.2.jar;C:utilsgroovy-2.4.14libcommons-logging-1.2.jar;C:utilsgroovy-2.4.14libgpars-1.2.1.jar;C:utilsgroovy-2.4.14libgroovy-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-ant-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-bsf-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-console-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-docgenerator-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-groovydoc-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-groovysh-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-jmx-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-json-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-jsr223-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-nio-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-servlet-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-sql-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-swing-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-templates-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-test-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-testng-2.4.14.jar;C:utilsgroovy-2.4.14libgroovy-xml-2.4.14.jar;C:utilsgroovy-2.4.14libhamcrest-core-1.3.jar;C:utilsgroovy-2.4.14libivy-2.4.0.jar;C:utilsgroovy-2.4.14libjansi-1.11.jar;C:utilsgroovy-2.4.14libjcommander-1.47.jar;C:utilsgroovy-2.4.14libjline-2.12.jar;C:utilsgroovy-2.4.14libjsp-api-2.0.jar;C:utilsgroovy-2.4.14libjsr166y-1.7.0.jar;C:utilsgroovy-2.4.14libjunit-4.12.jar;C:utilsgroovy-2.4.14libmultiverse-core-0.7.0.jar;C:utilsgroovy-2.4.14libqdox-1.12.1.jar;C:utilsgroovy-2.4.14libservlet-api-2.4.jar;C:utilsgroovy-2.4.14lib	estng-6.8.13.jar;C:utilsgroovy-2.4.14libxmlpull-1.1.3.1.jar;C:utilsgroovy-2.4.14libxstream-1.4.10.jar;C:Usersdev.m2
epositoryorgcodehausgroovygroovy-all2.4.14groovy-all-2.4.14.jar;C:Usersdev.m2
epositoryorgapachepoipoi-ooxml3.17poi-ooxml-3.17.jar;C:Usersdev.m2
epositorycomgithubvirtualdcurvesapi1.04curvesapi-1.04.jar;C:Usersdev.m2
epositoryorgapachepoipoi-ooxml-schemas3.17poi-ooxml-schemas-3.17.jar;C:Usersdev.m2
epositoryorgapachexmlbeansxmlbeans2.6.0xmlbeans-2.6.0.jar;C:Usersdev.m2
epositoryorgapachepoipoi3.17poi-3.17.jar;C:Usersdev.m2
epositorycommons-codeccommons-codec1.10commons-codec-1.10.jar;C:Usersdev.m2
epositoryorgapachecommonscommons-collections44.1commons-collections4-4.1.jar;C:Usersdev.m2
epositorystaxstax1.2.0stax-1.2.0.jar;C:Usersdev.m2
epositorystaxstax-api1.0.1stax-api-1.0.1.jar;C:Usersdev.m2
epositoryorgccilcowan	agsoup	agsoup1.2	agsoup-1.2.jar --encoding=UTF-8 C:ProjectHWJudeaPWYR_CyfrosrcmainjavaPWYR2_JIRA_Designs-ALL.groovy

我认为问题出在http-builder中,但我在项目中需要这种依赖:http-builder:jar:0.7.1 - > net.sourceforge.nekohtml:nekohtml:jar:1.9.16 - > xerces:xercesImpl:jar: 2.9.1:

我认为我的问题类似于httpbuilder and apache.poi.workbook maven problems

答案

如果你使用'@GrabConfig(systemClassLoader = true)`你需要删除它

另一答案

找到不包括xerces的解决方案

<dependency>
    <groupId>org.codehaus.groovy.modules.http-builder</groupId>
    <artifactId>http-builder</artifactId>
    <version>0.7.1</version>
    <exclusions>
        <exclusion>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </exclusion>
    </exclusions>
</dependency>

以上是关于java.lang.LinkageError Groovy 2.4.14 apache poi 3.17 jdk 1.8.0_92 http-builder 0.7.1的主要内容,如果未能解决你的问题,请参考以下文章

Tomcat 加载 jsp 异常:ServletException: java.lang.LinkageError

异常处理_Maven之web项目java.lang.LinkageError

解决java.lang.LinkageError: loader constraint violation: when resolving method "javax.mail.intern

weblogic???:java.lang.LinkageError: loader constraint violation in interface itable initialization

java.lang.LinkageError Groovy 2.4.14 apache poi 3.17 jdk 1.8.0_92 http-builder 0.7.1

java.lang.LinkageError:com / sun / xml / messaging / saaj / soap / SOAPDocumentImpl