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

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

问题描述

我看到以下错误:

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 具有以下依赖项:

The pom.xml has the following dependencies :

<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 的帖子他们建议将番石榴版本升级到 16.0.1 但这并没有帮助我解决我的问题.因为我是 cassandra 的新手,所以这里的一些说明会非常有帮助.为了添加更多背景,这个东西作为一个独立的项目工作,当我将此项目作为 maven 依赖项包含到其他项目时,它会引发此运行时错误.

I saw a post on stackoverflow here where they recommended to upgrade the guava version to 16.0.1 but that did not help me solve my problem. Some directions from here will be really helpful as I'm new to cassandra. To add more background this thing works as a standalone project, when I include this project as a maven dependency to some other project it raises this runtime error.

推荐答案

com.google.common.util.concurrent.FutureFallback 在 Guava 19.0 中已弃用,并自 Guava 20.0 起删除.

com.google.common.util.concurrent.FutureFallback is deprecated in Guava 19.0 and removed since Guava 20.0.

在升级 Cassandra 驱动程序之前,请使用 Guava 19.0,不要使用 Guava 20.0 或更高版本.

Use Guava 19.0 and do not use Guava 20.0 or greater, until you upgrade the Cassandra driver.

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

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