Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

I have a small site I built using the Play framework that I'm trying to run on an EC2 server against an Amazon RDS instance. I can run the app on my machine against the RDS instance and everything works fine. But when I deploy it to my EC2 server it gets this error:

The last packet successfully received from the server was 1,282,977,731,085 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.

        at play.db.DBPlugin.onApplicationStart(DBPlugin.java:87)

        at play.Play.start(Play.java:381)

        at play.Play.init(Play.java:247)

        at play.server.Server.main(Server.java:85)

Caused by: java.net.ConnectException: Connection refused

My first thought was it was some kind of security setting, but I have a Spring-based application running in Tomcat on the same EC2 server connecting to the same RDS instance with the same username and password, and it works just fine. Only the Play app has connection issues.

I can't seem to come up with an explanation for why this is happening, or ideas on how to fix it. 

Did anyone saw anything like this before?

1 Answer

0 votes
by (44.3k points)

Connect to the Database, in the same way, both locally and in production. This worked:

 

db.url=jdbc:mysql://localhost:3306/db

db.user=root

db.pass=password

 

%prod.db.url=jdbc:mysql://<your-db-ip>:3306/db

%prod.db.user=db_user

%prod.db.pass=db_password

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories

...