Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问为什么会出现Exception in thread "pool-1-thread-1" java.lang.NoSuchMethodError: com.google.common.collect.Maps.asMapEntryIterator #257

Closed
fonxian opened this issue Feb 26, 2016 · 2 comments

Comments

@fonxian
Copy link

fonxian commented Feb 26, 2016

刚开始用WebMagic
按照 http://webmagic.io/docs/zh/ 教程上试第一个爬虫的例子
出现错误,但是我在maven中添加了guava 15.0的依赖,但是依然没有用。
想请问是什么原因?
Exception in thread "pool-1-thread-1" java.lang.NoSuchMethodError: com.google.common.collect.Maps.asMapEntryIterator(Ljava/util/Set;Lcom/google/common/base/Function;)Ljava/util/Iterator; at com.google.common.collect.StandardTable$RowMap$EntrySet.iterator(StandardTable.java:771) at us.codecraft.webmagic.downloader.HttpClientGenerator.generateCookie(HttpClientGenerator.java:84) at us.codecraft.webmagic.downloader.HttpClientGenerator.generateClient(HttpClientGenerator.java:73) at us.codecraft.webmagic.downloader.HttpClientGenerator.getClient(HttpClientGenerator.java:45) at us.codecraft.webmagic.downloader.HttpClientDownloader.getHttpClient(HttpClientDownloader.java:63) at us.codecraft.webmagic.downloader.HttpClientDownloader.download(HttpClientDownloader.java:92) at us.codecraft.webmagic.Spider.processRequest(Spider.java:408) at us.codecraft.webmagic.Spider$1.run(Spider.java:322) at us.codecraft.webmagic.selector.thread.CountableThreadPool$1.run(CountableThreadPool.java:74) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

@fonxian
Copy link
Author

fonxian commented Mar 2, 2016

原因是:maven的依赖包冲突
解决方法:去掉其他的依赖包,之间只保留
<dependency> <groupId>us.codecraft</groupId> <artifactId>webmagic-core</artifactId> <version>0.5.3</version> </dependency> <dependency> <groupId>us.codecraft</groupId> <artifactId>webmagic-extension</artifactId> <version>0.5.2</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> </exclusions> </dependency>
就可以解决上述问题

@code4craft
Copy link
Owner

赞一个!

@sutra sutra added this to the WebMagic-0.7.4 milestone Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants