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

查看:225
本文介绍了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>

我在此处上看到了一个帖子 他们建议将番石榴版本升级到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 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天全站免登陆