简体   繁体   English

java.lang.NoSuchMethodError:com.google.common.collect.Sets.newConcurrentHashSet

[英]java.lang.NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet

I am trying to use the sstableloader for bulk loading to Cassandra. 我正在尝试使用sstableloader批量加载到Cassandra。 I am trying to use code from here : https://github.com/yukim/cassandra-bulkload-example 我正在尝试使用此处的代码: https//github.com/yukim/cassandra-bulkload-example

I run into java.lang.NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet exception during running of application. 我在运行应用程序期间遇到了java.lang.NoSuchMethodError:com.google.common.collect.Sets.newConcurrentHashSet异常。 The application imports the following libraries : 该应用程序导入以下库:

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.List;

import org.supercsv.io.CsvListReader;
import org.supercsv.prefs.CsvPreference;

import org.apache.cassandra.config.Config;
import org.apache.cassandra.dht.Murmur3Partitioner;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.io.sstable.CQLSSTableWriter;

The exception is coming from the following line of code : 例外情况来自以下代码行:

    // Prepare SSTable writer
CQLSSTableWriter.Builder builder = CQLSSTableWriter.builder();

I am using the following external jars for my application : 我正在为我的应用程序使用以下外部jar:

super-csv-2.0.0.jar
cassandra-all-3.4.jar
gradle-wrapper.jar
slf4j-api-1.7.19.jar
concurrentlinkedhashmap-lru-1.3.jar
slf4j-simple-1.7.19.jar
guava.jar
google-collections-1.0.jar

I am unable to figure which libraries i am missing. 我无法确定我缺少哪些库。

在此输入图像描述

Digging into com.google.comman.collect.Sets i cannot find the newConcurrentHashSet method. 深入研究com.google.comman.collect.Sets我找不到newConcurrentHashSet方法。 However the code seems to be calling it 但是代码似乎在调用它

在此输入图像描述

You should remove google-collections-1.0.jar . 你应该删除google-collections-1.0.jar

Google Collection is renamed to Guava so you have multiple implementation of the same classes. Google Collection已重命名为Guava,因此您可以多次实现相同的类。 And the "old" implementation of com.google.common.collect.Sets does not have this method and thats why you get the NoSuchMethodError . com.google.common.collect.Sets的“旧”实现没有这个方法,这就是为什么你得到NoSuchMethodError

https://code.google.com/archive/p/google-collections/ https://code.google.com/archive/p/google-collections/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 泽西岛启动问题:java.lang.NoSuchMethodError:com.google.common.collect.Sets.newIdentityHashSet() - Jersey Startup Issue : java.lang.NoSuchMethodError: com.google.common.collect.Sets.newIdentityHashSet() 卡夫卡连接 java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator; - Kafka Connect java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator; Google通讯录-java.lang.NoSuchMethodError:com.google.common.collect.ImmutableSet.of([Ljava / lang / Object;)Lcom / google / common / collect / ImmutableSet; - Google Contacts - java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.of([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet; java.lang.NoSuchMethodError:带有Selenium和Java的com.google.common.collect.ImmutableSet.of([Ljava / lang / Object;) - java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.of([Ljava/lang/Object;) with Selenium and Java JUnit抛出java.lang.NoSuchMethodError对于com.google.common.collect.Iterables.tryFind - JUnit throws java.lang.NoSuchMethodError For com.google.common.collect.Iterables.tryFind java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet() 即使使用“com.google.guava:guava:24.0-android” - java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet() even with 'com.google.guava:guava:24.0-android' java.lang.NoSuchMethodError: 'java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()' using Selenium Java - java.lang.NoSuchMethodError: 'java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()' using Selenium Java java.lang.NoSuchMethodError:com.google.common.base.Preconditions - java.lang.NoSuchMethodError: com.google.common.base.Preconditions java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableMap 尝试使用 Chromedriver 和 Maven 执行测试时出错 - java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableMap error when trying to execute tests using Chromedriver and Maven java.lang.NoSuchMethodError: 'java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()' 使用 ChromeDriver 和 Selenium - java.lang.NoSuchMethodError: 'java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()' using ChromeDriver and Selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM