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

Unable to connect to cassandra cluster using username & passsword after upgrading to 3.0 Releasse [DATACASS-765] #933

Closed
spring-projects-issues opened this issue May 18, 2020 · 4 comments
Assignees
Labels
in: core Issues in core support status: invalid An issue that we don't feel is valid

Comments

@spring-projects-issues
Copy link

andyfromktm opened DATACASS-765 and commented

After upgrading to spring boot 2.3.0, our application fails to start up due to cassandra connectivity authentication issue. We are using plain text username password authentication. It seems like you need to set 'advanced.auth-provider.class' cassandra java driver connection property


Affects: 3.0 GA (Neumann)

@spring-projects-issues
Copy link
Author

Mark Paluch commented

How did you configure authentication? Did you use Spring Boot's configuration properties or do you use programmatic configuration of the CqlSession?

@spring-projects-issues
Copy link
Author

andyfromktm commented

I configured our application using 'spring.data.cassandra' properties. I tried to debug it the problem seems to be here. But did not try it. In CassandraAutoConfiguration class.

private Config cassandraConfiguration(CassandraProperties properties) {
	CassandraDriverOptions options = new CassandraDriverOptions();
	PropertyMapper map = PropertyMapper.get();
	map.from(properties.getSessionName()).whenHasText()
			.to((sessionName) -> options.add(DefaultDriverOption.SESSION_NAME, sessionName));
	map.from(properties::getUsername).whenNonNull()
			.to((username) -> options.add(DefaultDriverOption.AUTH_PROVIDER_USER_NAME, username)
					.add(DefaultDriverOption.AUTH_PROVIDER_PASSWORD, properties.getPassword()));
	map.from(properties::getCompression).whenNonNull()
			.to((compression) -> options.add(DefaultDriverOption.PROTOCOL_COMPRESSION, compression));
	mapConnectionOptions(properties, options);
	mapPoolingOptions(properties, options);
	mapRequestOptions(properties, options);
	map.from(mapContactPoints(properties))
			.to((contactPoints) -> options.add(DefaultDriverOption.CONTACT_POINTS, contactPoints));
	map.from(properties.getLocalDatacenter()).to(
			(localDatacenter) -> options.add(DefaultDriverOption.LOAD_BALANCING_LOCAL_DATACENTER, localDatacenter));
	ConfigFactory.invalidateCaches();
	return ConfigFactory.defaultOverrides().withFallback(options.build())
			.withFallback(ConfigFactory.defaultReference()).resolve();
}

 

@spring-projects-issues
Copy link
Author

Mark Paluch commented

Thanks for the timely response. CassandraAutoConfiguration is part of Spring Boot. Can you please file a ticket in Spring Boot's issue tracker at https://github.com/spring-projects/spring-boot/issues?

@spring-projects-issues
Copy link
Author

andyfromktm commented

OK, Thanks

@spring-projects-issues spring-projects-issues added status: invalid An issue that we don't feel is valid in: core Issues in core support 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 Issues in core support status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants