What happens - NoSuchMethodError: com.datastax.driver.core.ResultSet.fetchMoreResults

我是研究僧i 提交于 2019-11-30 10:49:25

It is a conflict with the Cassandra driver-core that

libraryDependencies += "com.datastax.spark" % "spark-cassandra-connector_2.11" % "2.0.0-M3"

brings in.

If you go into the ~/.ivy2/cache/com.datastax.spark/spark-cassandra-connector_2.11 you will find a file called ivy-2.0.0-M3.xml

In that file the dependency is

com.datastax.cassandra" name="cassandra-driver-core" rev="3.0.2" force="true" 

Note that it is the 3.0.2 version of Cassandra driver core which gets overrun by the more recent one.

It just so happens that the latest source on Github does not show a implementation for fetchMoreResults which is inherited from interface PagingIterable

If you roll back the Git version to 3.0.x on Github, you'll find

 public ListenableFuture<ResultSet> fetchMoreResults();

So it looks like the newest Cassandra core drivers were rushed out the door incomplete. Or I might be missing something. Hope this helps.

tl;dr; Remove the latest driver and use the one embedded in the spark cassandra connector.

had the same problem

There were two dependencies in the project which both had cassandra-driver-core as a dependency

spark-cassandra-connector_2.11-2.0.0-M3 & job-server-api_2.10-0.8.0-SNAPSHOT

spark-cassandra-connecter expected ResultSet.fetchMoreResults to have a different return type, due to its shading of guava

expected . shade.com.datastax.spark.connector.google.common.util.concurrent.ListenableFuture

found . com.google.common.util.concurrent.ListenableFuture

switched to an unshaded version of cassandra-connector to correct the issue

The problem is resolved by removing cassandra-driver-core-3.1.0-shaded.jar from spark/jars/

a topical java duplicated classes conflicted problem?!

Need to confirm all jars included, if there're any duplicated jars involved.

The solution mentioned above is only one of case.

For all these problems run below command and check if there is any overlapping dependency exists-

mvn dependency:tree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!