我会尝试找到问题,但我做不到。
我将尝试将我的应用程序部署到 CloudBees 平台。在我的 application.conf 文件中,我设置了参数:
###############################################################
# Production config ###########################################
###############################################################
%production.application.mode=prod
%production.jpa.ddl=create
%production.db.url="jdbc:mysql:"${MYSQL_URL_EASYBOOKDB}
%production.db.driver=com.mysql.jdbc.Driver
%production.db.user=${MYSQL_USERNAME_EASYBOOKDB}
%production.db.pass=${MYSQL_PASSWORD_EASYBOOKDB}
在此之前,我将我的应用程序与 db 相关联
bees app:bind -db easybook -a zolt/easybook -as easybookdb
我已经为 playframework 安装了 cloudbees 模块。我像这样部署我的应用程序:
play bees:app:deploy --%production
有这个答案:
upload complete, response=<?xml version="1.0" encoding="UTF-8"?>
<ApplicationDeployArchiveResponse>
<id>zolt/easybook</id>
<url>http://easybook.zolt.cloudbees.net</url>
</ApplicationDeployArchiveResponse>
Application zolt/easybook deployed: http://easybook.zolt.cloudbees.net
之后,我去链接http://easybook.zolt.cloudbees.net并查看 tomcat 错误页面...
在日志中我看到堆栈跟踪:
SEVERE: Exception sending context initialized event to listener instance of class play.server.ServletWrapper
Jan 07 02:56:58 easybook i-9cd9d7e1: play.exceptions.DatabaseException: Cannot connected to the database, Communications link failure
Jan 07 02:56:58 easybook i-9cd9d7e1: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Jan 07 02:56:58 easybook i-9cd9d7e1: at play.db.DBPlugin.onApplicationStart(DBPlugin.java:161)
Jan 07 02:56:58 easybook i-9cd9d7e1: at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:525)
Jan 07 02:56:58 easybook i-9cd9d7e1: at play.Play.start(Play.java:533)
Jan 07 02:56:58 easybook i-9cd9d7e1: at play.Play.init(Play.java:305)
Jan 07 02:56:58 easybook i-9cd9d7e1: at play.server.ServletWrapper.contextInitialized(ServletWrapper.java:78)
Jan 07 02:56:58 easybook i-9cd9d7e1: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
Jan 07 02:56:58 easybook i-9cd9d7e1: at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
Jan 07 02:56:58 easybook i-9cd9d7e1: at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
Jan 07 02:56:58 easybook i-9cd9d7e1: at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
Jan 07 02:56:58 easybook i-9cd9d7e1: at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
Jan 07 02:56:58 easybook i-9cd9d7e1: at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
Jan 07 02:56:58 easybook i-9cd9d7e1: at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.staxnet.appserver.TomcatServerBase.startContainer(TomcatServerBase.java:120)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.staxnet.appserver.TomcatServerBase.start(TomcatServerBase.java:190)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.staxnet.appserver.StaxAppServer.main(StaxAppServer.java:89)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.staxnet.appserver.SnazAppServer.main(SnazAppServer.java:26)
Jan 07 02:56:58 easybook i-9cd9d7e1: at net.stax.appserver.bootstrap.Bootstrap.invokeAppServerMain(Bootstrap.java:41)
Jan 07 02:56:58 easybook i-9cd9d7e1: at net.stax.appserver.bootstrap.Bootstrap.main(Bootstrap.java:30)
Jan 07 02:56:58 easybook i-9cd9d7e1: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Jan 07 02:56:58 easybook i-9cd9d7e1: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:348)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2391)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2428)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2213)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.sql.DriverManager.getConnection(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.sql.DriverManager.getConnection(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at play.db.DBPlugin.onApplicationStart(DBPlugin.java:109)
Jan 07 02:56:58 easybook i-9cd9d7e1: ... 17 more
Jan 07 02:56:58 easybook i-9cd9d7e1: Caused by: java.net.ConnectException: Connection refused
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.PlainSocketImpl.socketConnect(Native Method)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.SocksSocketImpl.connect(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.Socket.connect(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.Socket.connect(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.Socket.<init>(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at java.net.Socket.<init>(Unknown Source)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
Jan 07 02:56:58 easybook i-9cd9d7e1: at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)
Jan 07 02:56:58 easybook i-9cd9d7e1: ... 28 more
Jan 07 02:56:58 easybook i-9cd9d7e1: Jan 07, 2014 10:56:57 AM org.apache.catalina.core.StandardContext start
Jan 07 02:56:58 easybook i-9cd9d7e1: SEVERE: Error listenerStart
如果我尝试通过 MysqWorkbench 连接到数据库,一切都很好......我做错了什么?