httpbuilder和apache.poi.workbook的maven问题 [英] httpbuilder and apache.poi.workbook maven problems

查看:231
本文介绍了httpbuilder和apache.poi.workbook的maven问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Maven POM文件中,我有以下内容:

 < dependency> 
< groupId> org.codehaus.groovy.modules.http-builder< / groupId>
< artifactId> http-builder< / artifactId>
< version> 0.7.1< / version>
< /依赖关系>

< dependency>
< groupId> org.apache.httpcomponents< / groupId>
< artifactId> httpclient< / artifactId>
< version> 4.5.2< / version>
< /依赖关系>

< dependency>
< groupId> org.apache.httpcomponents< / groupId>
< artifactId> httpcore< / artifactId>
< version> 4.4.5< / version>
< /依赖关系>

< dependency>
< groupId> org.apache.poi< / groupId>
< artifactId> poi< / artifactId>
< version> 3.17< / version>
< /依赖关系>

< dependency>
< groupId> org.apache.poi< / groupId>
< artifactId> poi-ooxml< / artifactId>
< version> 3.17< / version>
< /依赖关系>

< dependency>
< groupId> stax< / groupId>
< artifactId> stax< / artifactId>
< version> 1.2.0< / version>
< /依赖关系>

我想使用 Httpbuilder Workbook 来分析Excel文件。

  def res = http.post (path:....,requestContentType:JSON,contentType:ContentType.BINARY)

Workbook book = WorkbookFactory.create(res.responseData)

错误:


  1. Maven依赖关系






  java.lang.LinkageError :接口中的加载器约束违规itable 
初始化:解析方法时org.apache.xerces.dom.NodeImpl




  1. 如果我将排除列表添加到stax或httpbuilder中






  java.lang.NoSuchMethodError:javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava / lang / String; Z)V 




  1. 如果我删除了stax依赖项

  2. ol>



      javax.xml.stream.FactoryConfigurationError:找不到提供者com.bea.xml.stream.EventFactory 

    关于如何使用 HttpBuilder Workbook

    解决方案

    从http-builder依赖关系中排除xerces。在我的情况下,它解决了问题

     < dependency> 
    < groupId> org.codehaus.groovy.modules.http-builder< / groupId>
    < artifactId> http-builder< / artifactId>
    < version> 0.7.1< / version>
    <排除项>
    <排除>
    < groupId> xerces< / groupId>
    < artifactId> xercesImpl< / artifactId>
    < /排除>
    < /排除>
    < /依赖关系>


    In Maven POM file I have the following:

    <dependency>
        <groupId>org.codehaus.groovy.modules.http-builder</groupId>
        <artifactId>http-builder</artifactId>
        <version>0.7.1</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.2</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.5</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.17</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.17</version>
    </dependency>
    
    <dependency>
        <groupId>stax</groupId>
        <artifactId>stax</artifactId>
        <version>1.2.0</version>
    </dependency>
    

    I want to use Httpbuilder and Workbook in my project to parse Excel files.

    def res = http.post("path": "....", "requestContentType": JSON, contentType: ContentType.BINARY)
    
    Workbook book = WorkbookFactory.create(res.responseData)
    

    Errors:

    1. If I use my Maven dependencies


    java.lang.LinkageError: loader constraint violation in interface itable 
    initialization: when resolving method "org.apache.xerces.dom.NodeImpl
    

    1. If I add exclusion to stax or to httpbuilder


    java.lang.NoSuchMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
    

    1. If I delete stax dependency


    javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.EventFactory not found
    

    Any ideas on how to use HttpBuilder with Workbook?

    解决方案

    Exclude xerces from http-builder dependencies. In my case it solved problem

    <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>
    

    这篇关于httpbuilder和apache.poi.workbook的maven问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆