Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

IllegalArgumentException Being Thrown When Password Is Not Null #355

Closed
brobusf21 opened this issue Jul 4, 2018 · 4 comments
Closed

IllegalArgumentException Being Thrown When Password Is Not Null #355

brobusf21 opened this issue Jul 4, 2018 · 4 comments
Labels
component: rds RDS integration related issue type: documentation A documentation update

Comments

@brobusf21
Copy link

brobusf21 commented Jul 4, 2018

Hello,

I am experiencing an issue in which an IllegalArgumentException is being thrown because my RDS instance's password must not be null. However, I have confirmed by checking my AWS console that the password is not null and I'm unsure why this error is getting thrown; therefore, it's either a bug or it's something I am doing wrong. My application.properties file looks like the following:

cloud.aws.credentials.accessKey=XXXXXXXXXXXXXXXX
cloud.aws.credentials.secretKey=XXXXXXXXYYYYYYYYZZZZZZZ
cloud.aws.credentials.instanceProfile=true

cloud.aws.region.static=us-east-2

cloud.aws.rds.testInstance
cloud.aws.rds.testInstance.password=Testing123

I commented out the last three lines given that they were not making a difference.

Caused by: java.lang.IllegalArgumentException: Password must not be null
	at org.springframework.util.Assert.notNull(Assert.java:193) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
	at org.springframework.cloud.aws.jdbc.datasource.DataSourceInformation.<init>(DataSourceInformation.java:65) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
	at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.fromRdsInstance(AmazonRdsDataSourceFactoryBean.java:187) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
	at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.createDataSourceInstance(AmazonRdsDataSourceFactoryBean.java:153) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
	at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.createInstance(AmazonRdsDataSourceFactoryBean.java:130) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
	at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.createInstance(AmazonRdsDataSourceFactoryBean.java:45) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
	at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:141) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.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]
	... 30 common frames omitted

Any thoughts or pointers would be very helpful.

Thanks.

@cebbens
Copy link

cebbens commented Sep 10, 2018

I have the same issue.

application.properties
cloud.aws.region.static=us-east-1
cloud.aws.rds.test
cloud.aws.rds.test.databaseName=test
cloud.aws.rds.test.password=P@ssword
cloud.aws.rds.test.readReplicaSupport=true

pom.xml

org.springframework.cloud
spring-cloud-aws-jdbc

I noticed that AmazonRdsDataSourceFactoryBean is the responsible for creating the DataSource based on the above configuration.

The only way to set the password seems to be via its constructor which seems not to be called. Instead, the createInstance method is called which ends up not setting the password field (just reads from it). Moreover, password doesn't have a setter.

Additionally, the class AmazonRdsReadReplicaAwareDataSourceFactoryBean extends from AmazonRdsDataSourceFactoryBean, and having configured readReplicaSupport=true, one will suppose that the createInstance of this class would be called instead, but that isn't the case.

@aemruli Any thoughts? Is this a bug or is it missing configuration? How can I fix it?

Thanks in advance!
Cristian

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 1, 2018
@laxman225
Copy link

I got the same error and solved by removing the below entry.

cloud.aws.rds.test (@cebbens)
cloud.aws.rds.testInstance (@brobusf21)

https://stackoverflow.com/questions/51145248/cloud-aws-jdbc-datasource-throwing-assertion-error-password-must-not-be-null-fo

@spencergibb
Copy link
Contributor

Does the stack overflow answer resolve this issue?

@spencergibb spencergibb added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 29, 2019
@brobusf21
Copy link
Author

Hello, yes the issue is solved but the official documentation hasn’t been changed which can and was misleading. Thanks for reaching out.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 29, 2019
@spencergibb spencergibb added type: documentation A documentation update and removed status: feedback-provided Feedback has been provided labels Jan 29, 2019
@maciejwalkowiak maciejwalkowiak added the component: rds RDS integration related issue label May 29, 2020
maciejwalkowiak pushed a commit to maciejwalkowiak/spring-cloud-aws that referenced this issue May 30, 2020
maciejwalkowiak pushed a commit to maciejwalkowiak/spring-cloud-aws that referenced this issue Oct 15, 2020
maciejwalkowiak pushed a commit to maciejwalkowiak/spring-cloud-aws that referenced this issue Oct 15, 2020
maciejwalkowiak pushed a commit to maciejwalkowiak/spring-cloud-aws that referenced this issue Oct 15, 2020
maciejwalkowiak pushed a commit to maciejwalkowiak/spring-cloud-aws that referenced this issue Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: rds RDS integration related issue type: documentation A documentation update
Development

No branches or pull requests

6 participants