cloudfoundry / java-buildpack

Cloud Foundry buildpack for running Java applications
Apache License 2.0
439 stars 2.58k forks source link

getting exception while pushing play app to cloud foundry #322

Closed ishwarps closed 7 years ago

ishwarps commented 8 years ago

Hi, I have to use the cloud foundry auto configuration in play framework (2.5) . So I have configure the play application.conf file as bellow.

db.default.driver=${?cloud.services.mysql.connection.driver} db.default.url=${?cloud.services.mysql.connection.url} db.default.password=${?cloud.services.mysql.connection.password} db.default.username=${?cloud.services.mysql.connection.username}

The my built.sbt file. libraryDependencies ++= Seq( "mysql" % "mysql-connector-java" % "5.1.29", cache, javaWs, javaJpa )

This is code for access database.

con = DB.getConnection(); stmt = con.createStatement(); ResultSet rs=stmt.executeQuery("select table_name from information_schema.TABLES"); while(rs.next()){ tbName+=rs.getString("table_name")+"\n"; }

I forks this javabuild pack from this url. https://github.com/cloudfoundry/java-buildpack/blob/master/docs/framework-play_framework_jpa_plugin.md

but while pushing the app. I am getting following error.

OUT [info] application - Creating Pool for datasource 'default' 2016-08-25T04:28:28.57-0400 [APP/0] OUT [error] c.z.h.HikariConfig - HikariPool-1 - dataSource or dataSourceClassName or jdbcUrl is required. 2016-08-25T04:28:28.59-0400 [APP/0] OUT [info] application - Creating Pool for datasource 'default' 2016-08-25T04:28:28.59-0400 [APP/0] OUT [error] c.z.h.HikariConfig - HikariPool-2 - dataSource or dataSourceClassName or jdbcUrl is required.

I have use for java jpa reference from here: https://www.playframework.com/documentation/2.5.x/JavaJPA

I have use for jdbc connection reference with auto configuration from here: https://github.com/playframework/playframework/blob/2.5.x/documentation/manual/working/commonGuide/production/cloud/Deploying-CloudFoundry.md

Do i miss anything?

Thanks in advanced.

nebhale commented 8 years ago

Play Framework 2.5 support for auto-reconfiguration is not currently supported. There were massive changes to plugins in Play 2.5 (notably their removal) which will require a complete re-write of this feature. I'm not sure when, if ever, that will happen as there is simply not enough usage. You can disable auto-reconfiguration by setting the following environment variable cf set-env <APP> JBP_CONFIG_PLAY_FRAMEWORK_AUTO_RECONFIGURATION '{enabled: false}' which should allow your application to start, albeit without configuring the use of the bound service.