我有一个spring boot的应用程序,使用cassandra db 4.0,运行到带有Java1.8292的ubuntu 16.0中。
启动tomcat 9时,catalina.out日志中会显示以下消息:
> 2021-05-11 22:57:49.614 WARN 1184 --- [s0-admin-1] c.d.o.d.i.c.control.ControlConnection: [s0] Error connecting to Node(endPoint=127.0.0.1:9042, hostId=null,
> 2021-05-11 22:57:49.628 WARN 1184 --- [ main] ConfigServletWebServerApplicationContext: Exception encountered during context initialization - cancelling re
> 2021-05-11 22:57:49.645 INFO 1184 --- [main] ConditionEvaluationReportLoggingListener: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
> 2021-05-11 22:57:49.692 ERROR 1184 --- [main] o.s.boot.SpringApplication : Application run failed
我检查了cqlsh 6是否正常运行:
Connected to SSP at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 4.0 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.
cqlsh>
nodetool状态正常:
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 127.0.0.1 414.45 KiB 16 100.0% f457b508-1b91-456c-85bc-1a621c5c1d78 rack1
但是,Spring Boot无法连接到cassandra。它给了我这个连接到节点的错误(endpoint=127.0.0.1:9042,hostid=null)。
cassandra.yaml和cassandra-env.sh默认配置为127.0.0.1。
有人知道发生了什么事吗?
pom.xml
<!-- https://mvnrepository.com/artifact/com.datastax.cassandra/cassandra-driver-core -->
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.datastax.spark/spark-cassandra-connector -->
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector_2.12</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.12</artifactId>
<version>3.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>3.1.1</version>
</dependency>
1条答案
按热度按时间bpsygsoo1#
这是Cassandra的问题。将datastax/driver java的版本增加到4.11.1。此版本修复了真正的问题:意外故障(java.lang.illegalargumentexception:协议6中不支持的请求操作码:0)。
有关详细信息:
https://issues.apache.org/jira/browse/cassandra-16636?page=com.atlassian.jira.plugin.system.issuetabpanels%3aall-选项卡面板
https://datastax-oss.atlassian.net/browse/java-2936