【发布时间】:2017-02-02 01:47:54
【问题描述】:
我在运行我在 EC2 实例中开发的应用程序时遇到问题。当我执行 .jar (java -jar app.jar) 时,SpringBoot 应用程序启动,但在尝试连接到我的 MySQL RDS 数据库时失败。问题是当我在我的机器上本地运行应用程序时,数据库连接没有问题。
我已经打开了运行应用程序的端口 (8090) 和 MySql 端口 (3306) 用于入站和出站流量:
这是我得到的错误:
2016-09-23 17:46:38.132 INFO 10161 --- [main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8090
2016-09-23 17:46:38.604 INFO 10161 --- [main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-09-23 17:46:38.605 INFO 10161 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.54
2016-09-23 17:46:38.724 INFO 10161 --- [ost startStop 1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-09-23 17:46:38.725 INFO 10161 --- [ost startStop 1] o.s.web.context.ContextLoader: Root WebApplicationContext: initialization completed in 5028 ms
2016-09-23 17:48:48.476 ERROR 10161 --- [ost startStop 1] o.a.tomcat.jdbc.pool.ConnectionPool: Unable to create initial connections of pool.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
有什么办法可以解决这个问题吗?
非常感谢您的帮助
问候
安德烈斯
【问题讨论】:
标签: java mysql amazon-ec2 spring-boot amazon-rds