gpt4 book ai didi

maven - java.lang.NoClassDefFoundError : com/google/common/util/concurrent/FutureFallback

转载 作者:行者123 更新时间:2023-12-03 20:22:43 29 4
gpt4 key购买 nike

我看到以下错误:

java.lang.NoClassDefFoundError: com/google/common/util/concurrent/FutureFallback

cluster.connect()叫做 :
            String hosts = CassandraClientUtil.getHost();
String localDC = CassandraClientUtil.getLocalDC();
Cluster cluster = null;
if (StringUtils.isNotEmpty(localDC))
{
cluster = Cluster.builder().addContactPoints(hosts.split(","))
.withCredentials(CassandraCopsComponentLogger.USER_NAME, CassandraCopsComponentLogger.AUTH_CODE)
.withQueryOptions(new QueryOptions().setConsistencyLevel(ConsistencyLevel.LOCAL_ONE))
.withLoadBalancingPolicy(new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().withLocalDc(localDC).build())).build();
}
else
{
cluster = Cluster.builder().addContactPoints(hosts.split(","))
.withCredentials(CassandraCopsComponentLogger.USER_NAME, CassandraCopsComponentLogger.AUTH_CODE)
.withQueryOptions(new QueryOptions().setConsistencyLevel(ConsistencyLevel.LOCAL_ONE)).build();
}

Session session = cluster.connect();
CassandraCopsComponentLogger.mappingManager = new MappingManager(session);

pom.xml 具有以下依赖项:
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>16.0.1</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>2.1.9</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>3.9.0.Final</version>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>2.1.9</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>

我在stackoverflow上看到了一个帖子 here
他们建议将 Guava 版本升级到 16.0.1 但这并没有帮助我解决我的问题。由于我是 cassandra 的新手,因此这里的一些指示会非常有帮助。为了添加更多背景,这个东西作为一个独立的项目工作,当我将此项目作为 maven 依赖项包含到其他项目时,它会引发此运行时错误。

最佳答案

我将 Cassandra 驱动程序版本更新为最新可用,它应该可以解决问题。

<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.5.0</version>
</dependency>

关于maven - java.lang.NoClassDefFoundError : com/google/common/util/concurrent/FutureFallback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36853091/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com