cloudfoundry / java-buildpack-auto-reconfiguration

Auto-reconfiguration functionality for the Java Buildpack
Apache License 2.0
219 stars 103 forks source link

Null pointer exception after binding with postgresql database #59

Closed ishwarps closed 7 years ago

ishwarps commented 7 years ago

Hi, I am developing the sample play application in play framework 2.3. I have successfully use the auto-configuration features with mysql but when i am using the similar code with postgresql its giving me the following error.

2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR Jan 04, 2017 11:54:24 AM org.cloudfoundry.reconfiguration.play.Configurer configureDatabase
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR INFO: Auto-reconfiguring default
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR Exception in thread "main" java.lang.NullPointerException
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR         at java.util.Hashtable.put(Hashtable.java:459)
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR         at java.util.Properties.setProperty(Properties.java:166)
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR         at java.lang.System.setProperty(System.java:796)
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR         at org.cloudfoundry.reconfiguration.play.Configurer.configureDatabase(Configurer.java:90)
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR         at org.cloudfoundry.reconfiguration.play.Configurer.processDatabase(Configurer.java:66)
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR         at org.cloudfoundry.reconfiguration.play.Configurer.configure(Configurer.java:53)
2017-01-04T11:54:24.11+0000 [APP/PROC/WEB/0]ERR         at org.cloudfoundry.reconfiguration.play.Bootstrap.main(Bootstrap.java:43)
2017-01-04T11:54:24.13+0000 [APP/PROC/WEB/0]OUT Exit status 1.

This is my applicaiton.conf file.

db.default.driver=${?cloud.services.postgresql-conn.connection.driver}
db.default.url=${?cloud.services.postgresql-conn.connection.url}
db.default.password=${?cloud.services.postgresql-conn.connection.password}
db.default.username=${?cloud.services.postgresql-conn.connection.username}

This is my build.sbt

import play.Project._
name := "hello-play-2_3-scala"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
  "org.webjars" %% "webjars-play" % "2.3-M1",
  "org.webjars" % "bootstrap" % "2.3.1",
  "org.webjars" % "requirejs" % "2.1.11-1",
  "postgresql" % "postgresql" % "9.1-901-1.jdbc4",
   javaEbean,
   javaJdbc,
   jdbc,
   anorm
  )
lazy val root = (project in file(".")).addPlugins(PlayScala)

This is my plugin.sbt

// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3-M1")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.0-M2a")
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0-M2a")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0-M2a")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.0-M2a")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0-M2a")
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0-M2a")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0-M2a")

This is my manifest file:

---
applications:
- name: activator-hello-play2_3-scala-scala-postgresql
  memory: 1GB
  instances: 1
  path: target/universal/hello-play-2_3-scala-1.0-SNAPSHOT.zip
  services:
    - post-conn
  env:
    SPRING_PROFILES_DEFAULT: cloud

I have attached here starting log.

buildpack-logs.txt

Thanks in advanced.

ishwarps commented 7 years ago

I have successfully tested with auto reconfiguration with postgresql 9.5. Its giving above error in postgresql 9.3. is there bugs?

nebhale commented 7 years ago

As the auto-reconfiguration support has lagged for Play releases without any real request for keeping up with it, the forth coming 2.x line will drop all support for Play auto-reconfiguration.