- Newest
- Most votes
- Most comments
Hello.
Is it possible for you to share the contents of "application.properties"?
It's possible that the authentication information for the database is incorrect. Also, check to see if ElasticBeanstalk and RDS are deployed in different VPCs, making it impossible for them to communicate over the network.
Based on the logs you've provided, it appears that your Spring Boot application is failing to start properly on AWS Elastic Beanstalk, which is causing the 502 Bad Gateway error. The main issue seems to be related to the database configuration.
The error message indicates that the application is unable to create the JPA EntityManagerFactory due to a problem with the JDBC configuration. Specifically, it's unable to determine the Dialect for your database connection.
This suggests that your application is not able to connect to your RDS PostgreSQL database. There could be several reasons for this:
-
Database connection details: Ensure that your application.properties or application.yml file contains the correct database connection details (URL, username, password) for your RDS instance when deployed to Elastic Beanstalk.
-
Security Group settings: Check if the security group associated with your Elastic Beanstalk environment allows inbound connections to your RDS instance.
-
Environment variables: If you're using environment variables to store database credentials, make sure they are correctly set in your Elastic Beanstalk environment configuration.
-
Database dialect: You might need to explicitly specify the Hibernate dialect for PostgreSQL in your application properties:
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
-
Database driver: Ensure that the PostgreSQL JDBC driver is included in your application's dependencies.
As for your question about Lombok, it's unlikely that Lombok is causing this particular issue. The problem appears to be specifically related to the database connection.
To resolve this, double-check your database configuration, ensure that your RDS instance is accessible from your Elastic Beanstalk environment, and verify that all necessary environment variables or configuration properties are correctly set. Once the database connection is properly established, your application should start successfully, and the 502 Bad Gateway error should be resolved.
Sources
QuickStart: Deploy a Java application to Elastic Beanstalk - AWS Elastic Beanstalk
ElasticBeanstalkClient (AWS SDK for Java - 2.21.29)
Configuring the proxy server - AWS Elastic Beanstalk
DescribeConfigurationSettingsRequest (AWS SDK for Java - 2.21.29)
Relevant content
- asked 10 months ago
- asked a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a month ago
spring.datasource.url=jdbc:postgresql://my-db.[redacted].eu-north-1.rds.amazonaws.com:5432/[db_name] This is in the app application.properties and it work on my machine. But when I upload the jar to elastic beanstalk and create an environement I get 502 Bad Gateway.
Regarding the VPC I only have one and it seems that booths are on it. But maybe, since I'm new to AWS, I'm missing something. Maybe it's the VPC security groups. Honestly there seems that a lot of things can go wrong.
Like I said on my machine the same Spring app connects OK with the RDS database. But when I set up de elastic beanstalk environment it gives 502 Bad Gateway.
Thanks for your reply! I will also try a Docker approach and see how that works.