欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.toString(Ljava

程序员文章站 2022-05-05 14:48:42
...
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.toString(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String;
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/Charsets

 

        <dependency>
            <groupId>net.sourceforge.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
            <version>2.15</version>
        </dependency>

使用WebClient报错!!

 

最后方案:

增加依赖

         <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

         <!--jsoup解析html页面-->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.8.3</version>
        </dependency>

        <!--高级http解析工具-->
        <dependency>
            <groupId>net.sourceforge.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
            <version>2.19</version>
        </dependency>

成功!!!!!!!!!

相关标签: htmlunit