我正试图将我的spring引导应用程序连接到aws keyspaces,我已经尝试了aws帮助手册中提到的每一步,但我仍然无法连接,任何关于如何实现上述功能的见解都是值得赞赏的。
我已经列出了下面的配置代码,库和异常
CassandraConfig.java
@Configuration
public class CassandraConfig {
File driverConfig = new File(System.getProperty("user.dir")+"/application.conf");
@Bean
public CqlSession session() throws NoSuchAlgorithmException {
DriverConfigLoader loader = DriverConfigLoader.fromClasspath("application.conf");
return CqlSession.builder().
withConfigLoader(loader).
withKeyspace("catalog").
build();
}
}
application.conf
datastax-java-driver {
basic.contact-points = [ "cassandra.ap-southeast-1.amazonaws.com:9142"]
advanced.auth-provider{
class = PlainTextAuthProvider
username = "********-at-***********"
password = "***************gbw8FcN1qZAd*************"
}
basic.load-balancing-policy {
local-datacenter = "ap-southeast-1"
}
advanced.ssl-engine-factory {
class = DefaultSslEngineFactory
truststore-path = "./src/main/resources/cassandra_truststore.jks"
truststore-password = "***********"
}
}
pom dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
<!-- DataStax Driver -->
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-core</artifactId>
<version>4.6.0</version>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-query-builder</artifactId>
<version>4.6.0</version>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-mapper-runtime</artifactId>
<version>4.6.0</version>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>native-protocol</artifactId>
<version>1.4.11</version>
</dependency>
Java Version 1.8
SpringBoot Version : 2.0.2(i cant change this)
启动应用程序时的异常
loader is::{default=com.datastax.oss.driver.internal.core.config.typesafe.TypesafeDriverExecutionProfile$Base@417751d3}
2021-08-11T18:44:07.143+0530 INFO DataStax Java driver for Apache Cassandra(R) (com.datastax.oss:java-driver-core) version 4.6.0
2021-08-11T18:44:09.887+0530 INFO Using native clock for microsecond precision
2021-08-11T18:44:12.652+0530 INFO [s0] Failed to connect with protocol DSE_V2, retrying with DSE_V1
2021-08-11T18:44:12.875+0530 INFO [s0] Failed to connect with protocol DSE_V1, retrying with V4
2021-08-11T18:44:13.615+0530 INFO PID obtained through native call to getpid(): 6372
2021-08-11T18:44:14.020+0530 WARN [s0] Control node cassandra.ap-southeast-1.amazonaws.com/18.141.148.47:9142 has an entry for itself in system.peers: this entry will be ignored. This is likely due to a misconfiguration; please verify your rpc_address configuration in cassandra.yaml on all nodes in your cluster.
2021-08-11T18:44:14.026+0530 WARN [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner', token map will be empty.
2021-08-11T18:44:14.458+0530 WARN [s0] Unknown peer 1dd0fac0-a61a-3748-bbe0-df3a5d7cfef3, excluding from schema agreement check
2021-08-11T18:44:15.132+0530 WARN [s0|/18.141.148.55:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xf51727d7, L:/192.168.31.197:51741 - R:18.141.148.55/18.141.148.55:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:15.143+0530 WARN [s0|/18.141.148.54:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xfe40b78e, L:/192.168.31.197:51742 - R:18.141.148.54/18.141.148.54:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:15.154+0530 WARN [s0|/18.141.148.49:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x9dd8ed6d, L:/192.168.31.197:51743 - R:18.141.148.49/18.141.148.49:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:15.158+0530 WARN [s0|/18.141.148.51:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x4d2ad399, L:/192.168.31.197:51745 - R:18.141.148.51/18.141.148.51:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:15.163+0530 WARN [s0|/18.141.148.45:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x239b8f1d, L:/192.168.31.197:51744 - R:18.141.148.45/18.141.148.45:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:15.192+0530 WARN [s0|/18.141.148.48:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xf6326127, L:/192.168.31.197:51747 - R:18.141.148.48/18.141.148.48:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:15.206+0530 WARN [s0|/18.141.148.50:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xdd3db16c, L:/192.168.31.197:51746 - R:18.141.148.50/18.141.148.50:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:15.288+0530 WARN [s0|/18.141.148.52:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x63719133, L:/192.168.31.197:51748 - R:18.141.148.52/18.141.148.52:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.237+0530 WARN [s0|/18.141.148.55:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x8f330d25, L:/192.168.31.197:51750 - R:18.141.148.55/18.141.148.55:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.285+0530 WARN [s0|/18.141.148.51:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x8711832c, L:/192.168.31.197:51752 - R:18.141.148.51/18.141.148.51:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.286+0530 WARN [s0|/18.141.148.49:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xa7f76814, L:/192.168.31.197:51751 - R:18.141.148.49/18.141.148.49:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.335+0530 WARN [s0|/18.141.148.48:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xa2eddf2b, L:/192.168.31.197:51754 - R:18.141.148.48/18.141.148.48:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.362+0530 WARN [s0|/18.141.148.54:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xaea1e9a3, L:/192.168.31.197:51755 - R:18.141.148.54/18.141.148.54:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.390+0530 WARN [s0|/18.141.148.45:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xb9184902, L:/192.168.31.197:51756 - R:18.141.148.45/18.141.148.45:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.402+0530 WARN [s0|/18.141.148.52:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xe0cfbc84, L:/192.168.31.197:51757 - R:18.141.148.52/18.141.148.52:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:16.425+0530 WARN [s0|/18.141.148.50:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xc113c634, L:/192.168.31.197:51758 - R:18.141.148.50/18.141.148.50:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:17.169+0530 INFO Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2021-08-11T18:44:18.207+0530 WARN [s0|/18.141.148.51:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xec97e390, L:/192.168.31.197:51760 - R:18.141.148.51/18.141.148.51:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:18.292+0530 WARN [s0|/18.141.148.45:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xcaba8449, L:/192.168.31.197:51761 - R:18.141.148.45/18.141.148.45:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:18.464+0530 INFO Detected Guava >= 19 in the classpath, using modern compatibility layer
2021-08-11T18:44:18.540+0530 INFO Could not load JNR C Library, native system calls through this library will not be available (set this logger level to DEBUG to see the full stack trace).
2021-08-11T18:44:18.541+0530 INFO Using java.lang.System clock to generate timestamps.
2021-08-11T18:44:18.549+0530 WARN [s0|/18.141.148.55:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x85d221be, L:/192.168.31.197:51763 - R:18.141.148.55/18.141.148.55:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:18.578+0530 WARN [s0|/18.141.148.48:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x164f0879, L:/192.168.31.197:51764 - R:18.141.148.48/18.141.148.48:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:18.636+0530 WARN [s0|/18.141.148.54:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x60ff3d7f, L:/192.168.31.197:51765 - R:18.141.148.54/18.141.148.54:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:18.659+0530 WARN [s0|/18.141.148.52:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x2d86b9ce, L:/192.168.31.197:51766 - R:18.141.148.52/18.141.148.52:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:18.660+0530 WARN [s0|/18.141.148.49:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xdf4b5dda, L:/192.168.31.197:51767 - R:18.141.148.49/18.141.148.49:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:18.723+0530 WARN [s0|/18.141.148.50:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xd47af409, L:/192.168.31.197:51768 - R:18.141.148.50/18.141.148.50:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:19.287+0530 INFO Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
2021-08-11T18:44:22.172+0530 WARN [s0|/18.141.148.55:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x39860126, L:/192.168.31.197:51790 - R:18.141.148.55/18.141.148.55:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:22.352+0530 WARN [s0|/18.141.148.50:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xf3522b2c, L:/192.168.31.197:51792 - R:18.141.148.50/18.141.148.50:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:22.472+0530 WARN [s0|/18.141.148.51:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xa42bf4d4, L:/192.168.31.197:51793 - R:18.141.148.51/18.141.148.51:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:22.496+0530 WARN [s0|/18.141.148.45:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x0c29743b, L:/192.168.31.197:51794 - R:18.141.148.45/18.141.148.45:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:22.496+0530 WARN [s0|/18.141.148.48:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xd201620c, L:/192.168.31.197:51795 - R:18.141.148.48/18.141.148.48:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:22.912+0530 WARN [s0|/18.141.148.54:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xa7d112d5, L:/192.168.31.197:51796 - R:18.141.148.54/18.141.148.54:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:23.092+0530 WARN [s0|/18.141.148.49:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0x01f2f9ae, L:/192.168.31.197:51797 - R:18.141.148.49/18.141.148.49:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:23.233+0530 WARN [s0|/18.141.148.52:9142] Error while opening new channel (ConnectionInitException: [s0|id: 0xb0bf6ce7, L:/192.168.31.197:51798 - R:18.141.148.52/18.141.148.52:9142] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=DataStax Java driver for Apache Cassandra(R), DRIVER_VERSION=4.6.0, CLIENT_ID=80d09282-8d24-4822-af65-15ccb7198c5c}): failed to send request (javax.net.ssl.SSLException: SSLEngine closed already))
2021-08-11T18:44:28.113+0530 INFO Stopping service [Tomcat]
2021-08-11T18:44:28.139+0530 ERROR Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cassandraSession' defined in class path resource [org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.class]: Invocation of init method failed; nested exception is com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/0:0:0:0:0:0:0:1:9042 (com.datastax.driver.core.exceptions.TransportException: [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect), localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.TransportException: [localhost/127.0.0.1:9042] Cannot connect))
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:741) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at com.omnistream.clickandcollect.SpringBootWebApplication.main(SpringBootWebApplication.java:23) [classes/:?]
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/0:0:0:0:0:0:0:1:9042 (com.datastax.driver.core.exceptions.TransportException: [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect), localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.TransportException: [localhost/127.0.0.1:9042] Cannot connect))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:232) ~[cassandra-driver-core-3.4.0.jar:?]
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) ~[cassandra-driver-core-3.4.0.jar:?]
at com.datastax.driver.core.Cluster$Manager.negotiateProtocolVersionAndConnect(Cluster.java:1619) ~[cassandra-driver-core-3.4.0.jar:?]
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1537) ~[cassandra-driver-core-3.4.0.jar:?]
at com.datastax.driver.core.Cluster.init(Cluster.java:159) ~[cassandra-driver-core-3.4.0.jar:?]
at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:330) ~[cassandra-driver-core-3.4.0.jar:?]
at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:305) ~[cassandra-driver-core-3.4.0.jar:?]
at com.datastax.driver.core.Cluster.connect(Cluster.java:247) ~[cassandra-driver-core-3.4.0.jar:?]
at org.springframework.data.cassandra.config.CassandraCqlSessionFactoryBean.connect(CassandraCqlSessionFactoryBean.java:89) ~[spring-data-cassandra-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.data.cassandra.config.CassandraCqlSessionFactoryBean.afterPropertiesSet(CassandraCqlSessionFactoryBean.java:82) ~[spring-data-cassandra-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.data.cassandra.config.CassandraSessionFactoryBean.afterPropertiesSet(CassandraSessionFactoryBean.java:59) ~[spring-data-cassandra-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1765) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
... 16 more
任何关于如何实现连接的见解都是非常感谢的。由于
这可能是你的连接,这里有一个Github示例,关于如何使用Spring连接到Keyspaces。
但是为了获得更好的表的可观察性。这是一个Github存储库,它将使用CloudFormation模板设置CloudWatch指标。这些指标将为您提供更多的可见性,以确保它不是容量问题,它确实是一个连接问题。
application.conf可能正在为SSLEngineFactory创建问题。在以下示例中,在AWS Keyspaces Connection
中检查本地数据中心的值格式datastax-java-driver {
basic.contact-points = ["cassandra.us-east-2.amazonaws.com:9142"]
basic.load-balancing-policy {
class = DefaultLoadBalancingPolicy
local-datacenter = us-east-2
}
advanced {
auth-provider = {
class = software.aws.mcs.auth.SigV4AuthProvider
aws-region = us-east-2
}
ssl-engine-factory {
class = DefaultSslEngineFactory
truststore-path = "./src/main/resources/cassandra_truststore.jks"
truststore-password = "my_password"
}
}
}