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

查看:620
本文介绍了java.lang.NoSuchMethodError:com.google.common.collect.Sets.newConcurrentHashSet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用sstableloader批量加载到Cassandra。我正在尝试从此处使用代码:



深入com.google.comman.collect.Sets我找不到newConcurrentHashSet方法。但是,代码似乎正在调用它



解决方案

您应删除 google-collections-1.0.jar



Google收藏夹已重命名为Guava,因此您可以对同一类进行多次实现。而且 com.google.common.collect.Sets 的旧实现没有这种方法,这就是为什么出现 NoSuchMethodError



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


I am trying to use the sstableloader for bulk loading to Cassandra. I am trying to use code from here : https://github.com/yukim/cassandra-bulkload-example

I run into java.lang.NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet exception during running of application. 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 :

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. However the code seems to be calling it

解决方案

You should remove google-collections-1.0.jar.

Google Collection is renamed to Guava so you have multiple implementation of the same classes. And the "old" implementation of com.google.common.collect.Sets does not have this method and thats why you get the NoSuchMethodError.

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

这篇关于java.lang.NoSuchMethodError:com.google.common.collect.Sets.newConcurrentHashSet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆