我有一个Spring Boot的应用程序,使用Cassandra DB 4.0,运行到带有java 1.8_292的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>
节点工具状态正常:
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
然而,弹簧靴无法连接到卡桑德拉。它给了我这个错误[s0]连接到节点时出错(endPoint=127.0.0.1:9042,hostId=null,.
casandra.yaml和casandra-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>
这是一个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