Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot 2.3.1.Release and Cassandra Connectivity DriverTimeout Issue [DATACASS-796] #963

Closed
spring-projects-issues opened this issue Aug 12, 2020 · 1 comment
Assignees
Labels
in: core status: invalid

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Aug 12, 2020

Akhilesh Kumar opened DATACASS-796 and commented

I am upgrading to Spring boot version 2.3.1.Release. So, there is a major change in Spring Data Cassandra due to Java driver version upgrade to v4. I am stuck on application startup because there is a DriverTimeout exception being thrown:
 com.datastax.oss.driver.api.core.DriverTimeoutException: [s0|control|id: 0x8572a9d7, L:/My_IPv4:Random_Port - R:/Cassandra_Server:Port] Protocol initialization request, step 1 (OPTIONS): timed out after 500 ms
 
Cassandra Config:

@Bean(name = "mySession")
@Primary
public CqlSession session() {

     String containerIpAddress = getContactPoints();
     int containerPort = getPort();
     InetSocketAddress containerEndPoint = new InetSocketAddress(containerIpAddress,      containerPort);
    return       CqlSession.builder().withLocalDatacenter(getLocalDataCenter()).addContactPoint(containerEndPoint).withAuthCredentials(dbProperties.getCassandraUserName(), dbProperties.getCassandraPassword()).withKeyspace(getKeyspaceName()).build();
}

I have also tried using DriverConfigLoader option by explicitly setting connection timeout as:

  
@Bean(name = "mySession")
@Primary
public CqlSession session() {
String containerIpAddress = getContactPoints();
int containerPort = getPort();
InetSocketAddress containerEndPoint = new InetSocketAddress(containerIpAddress, containerPort);

DriverConfigLoader loader =DriverConfigLoader.programmaticBuilder().withDuration(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT, Duration.ofSeconds(5)).build();
return {{CqlSession.builder().withLocalDatacenter(getLocalDataCenter()).withConfigLoader(loader).addContactPoint(containerEndPoint).withAuthCredentials(dbProperties.getCassandraUserName(),dbProperties.getCassandraPassword()).withKeyspace(getKeyspaceName()).build();
}

, but to no avail and same exception is being thrown. My current Spring boot version is 2.2.0.Release and I am not even specifying any timeout there and its working fine


Reference URL: https://stackoverflow.com/questions/63378497/spring-boot-2-3-1-release-and-cassandra-drivertimeout-issue

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Aug 13, 2020

Mark Paluch commented

I don't think there's anything we can do from a Spring Data side as your code interacts with the Cassandra driver directly. Please check StackOverflow or the Driver Jira at https://datastax-oss.atlassian.net/projects/JAVA/issues for further guidance

@spring-projects-issues spring-projects-issues added status: invalid in: core labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: invalid
Projects
None yet
Development

No branches or pull requests

2 participants