You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sample java can not start by Missing environment variable DB_NAME
How to fix jdbc config error
Error log:
2023-11-30T01:31:12.294+09:00 2023-11-29 16:31:12.293 ERROR 7 --- [ main] o.s.boot.SpringApplication : Application run failed
2023-11-30T01:31:12.294+09:00
Copy
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderDaoImpl': Unsatisfied dependency expressed through field 'jdbc'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDataSource' defined in class path resource [com/amazon/aws/partners/saasfactory/configuration/DataSourceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDataSource' threw exception; nested exception is java.lang.IllegalStateException: Missing environment variable DB_NAME
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderDaoImpl': Unsatisfied dependency expressed through field 'jdbc'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDataSource' defined in class path resource [com/amazon/aws/partners/saasfactory/configuration/DataSourceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDataSource' threw exception; nested exception is java.lang.IllegalStateException: Missing environment variable DB_NAME
See the instructions for Step 7 in the Getting Started guide. The database name is required for the sample app.
The database name is optional in the App Config form because a database name may not be required by your application (it may be hard coded in your app). Setting the database name in the App Config also triggers the RDS bootstrap Lambda during tenant onboarding.
Sample java can not start by Missing environment variable DB_NAME
How to fix jdbc config error
Error log:
Environment
Other information
I configed Postgres, also auto created database.
I can not see where set env in https://github.com/awslabs/aws-saas-boost/blob/main/samples/java/Dockerfile
But sample java need env in https://github.com/awslabs/aws-saas-boost/blob/main/samples/java/src/main/java/com/amazon/aws/partners/saasfactory/configuration/DataSourceConfig.java#L35
The text was updated successfully, but these errors were encountered: