htmlunit爬蟲遇到的坑 'application/javascript'

警告: Expected content type of 'application/javascript' or 'application/ecmascript'

         for remotely loaded JavaScript element at 'http://jquery-1.4.2.min.js', but got ''.

java.lang.NoSuchMethodError:org.apache.commons.io.IOUtils.toString(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String;

 

解決:

版本太高,換成低版本。

<!-- https://mvnrepository.com/artifact/net.sourceforge.htmlunit/htmlunit -->
<dependency>
    <groupId>net.sourceforge.htmlunit</groupId>
    <artifactId>htmlunit</artifactId>
    <version>2.15</version>
</dependency>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章