PlayFramework 1.2.7应用程序部署到CloudBees

时间:2014-01-07 11:20:21

标签: playframework-1.x cloudbees playframework-evolutions

我会尝试找到问题,但我不能。

我会尝试将我的应用程序部署到CloudBees平台。 在我的application.conf文件中,我设置了params:

###############################################################
# 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连接数据库,那一切都很好...... 我做错了什么?

1 个答案:

答案 0 :(得分:0)

我认为您没有以正确的方式将数据库与您的应用程序绑定。

根据数据库绑定正在运行的Play1 ClickStart。这些是步骤:

1.在application.conf你应该有这个:

db=java:comp/env/jdbc/mydb
jpa.dialect=org.hibernate.dialect.MySQL5Dialect

2.将应用程序绑定到数据库

$bees app:bind -a appName -db dbName -as mydb

3.重新部署应用程序

 bees app:deploy -a MY_APP -t tomcat7 myapp.war

有关Play1的官方文档为here