简体   繁体   English

尝试在托管bean中连接到Cassandra时出现番石榴错误

[英]Getting a guava error while trying to connect to Cassandra in a managed bean

It says i need guava's version to be over 16, but I'm using guava 19. I even did mvn dependency:tree to check if something else is using guava, but there's only that version. 它说我需要番石榴的版本必须超过16,但是我正在使用番石榴19。我什至做了mvndependency:tree来检查是否有其他东西正在使用番石榴,但是只有那个版本。

@Named(value = "glicoseChart")
@Dependent
public class GlicoseChart implements Serializable{

private LineChartModel glicoseModel;
public LongTermPersistence longTerm;

@PostConstruct
public void init() {
    createLineModels();
}

public LineChartModel getGlicoseModel() {
    return glicoseModel;
}

private void createLineModels() {     
    glicoseModel = initLinearModel();
}

private LineChartModel initLinearModel() 
{
    LineChartModel model = new LineChartModel();

longTerm = new LongTermPersistence();

// VVVVVVVVVVVVV
longTerm.connectB();

It gives an error trying to connect. 尝试连接时出现错误。 And the connection code: 以及连接代码:

 public void connectB()
 {
   this.cluster = Cluster.builder()
           .addContactPoint("127.0.0.1")
           .withPort(9042)
           .build();
   session = cluster.connect();
}

It gives an error trying to build the cluster. 尝试构建集群时出现错误。 However, if I try to connect in another class, and not in the managed bean, it works just fine. 但是,如果我尝试在另一个类中而不是在托管Bean中进行连接,则可以正常工作。

However, inside the managed bean, i get this error: 但是,在托管bean中,我收到此错误:

Caused by: com.datastax.driver.core.exceptions.DriverInternalError: Detected incompatible version of Guava in the classpath. 原因:com.datastax.driver.core.exceptions.DriverInternalError:在类路径中检测到不兼容的Guava版本。 You need 16.0.1 or higher. 您需要16.0.1或更高版本。 at com.datastax.driver.core.GuavaCompatibility.selectImplementation(GuavaCompatibility.java:138) at com.datastax.driver.core.GuavaCompatibility.(GuavaCompatibility.java:52) 在com.datastax.driver.core.GuavaCompatibility。(GuavaCompatibility.java:52)处com.datastax.driver.core.GuavaCompatibility.selectImplementation(GuavaCompatibility.java:138)

The thing is, i'm using guava-19.0, and it's saying im using 16 below, which is not true, since I can use that piece of code in another class' main. 问题是,我使用的是guava-19.0,它说的是im在下面使用16,这是不正确的,因为我可以在另一类的main中使用那段代码。 I'm using cassandra 3 btw. 我正在使用cassandra 3 btw。

You should use the same guava version as your cassandra-driver-core dependency, to be safe. 为了安全起见,您应该使用与cassandra-driver-core依赖项相同的番石榴版本。 Eg cassandra-driver-core 3.0.0 uses guava 16.0.1 例如cassandra-driver-core 3.0.0使用番石榴16.0.1

See https://mvnrepository.com/artifact/com.datastax.cassandra/cassandra-driver-core 参见https://mvnrepository.com/artifact/com.datastax.cassandra/cassandra-driver-core

The error message only guesses your guava version. 该错误消息仅猜测您的番石榴版本。

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

相关问题 尝试通过hector API连接到cassandra时出错 - Error while trying to connect to cassandra through hector API 尝试使用Spark Streaming连接Cassandra数据库时出错 - Error while trying to connect cassandra database using spark streaming 创建bean时出错 - Getting error while creating bean 尝试连接到本地主机phpmyadmin时出现错误 - I am getting error while trying to connect to localhost phpmyadmin 尝试使用smack连接Facebook聊天时出现此错误 - Getting this error while trying to connect facebook chat using smack 尝试连接到 SQL-Server 2014 时出现 SSL 错误 - Getting SSL error while trying to connect to SQL-Server 2014 尝试将 JPA 与 spring controller 连接,但得到:“创建名称为“mainController”的 bean 时出错:通过。 - Trying to connect JPA with spring controller but getting: 'Error creating bean with name 'mainController': Unsatisfied dependency expressed through..' 尝试访问会话Bean时出错 - Error while trying to access a session bean 使用 Java 客户端连接到 AWS 托管的 Cassandra - Connect to AWS managed Cassandra with Java client 尝试使用不是实体的 object 创建 SpringFramework Bean 时出现“IllegalArgumentException:不是托管类型” - Getting “IllegalArgumentException: Not a managed type” When trying to create SpringFramework Bean using object that is not an Entity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM