Reputation: 3783
I am not able to properly deploy my Play Frmaework app
(Java) on Heroku by using a PostgreSQL database.
Procfile
web: target/universal/stage/bin/name -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL
built.sbt:
name := """name"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
javaWs
)
libraryDependencies += "org.postgresql" % "postgresql" % "9.3-1100-jdbc4"
Heroku's logs:
←[36m2015-05-20T13:35:43.429517+00:00 app[web.1]:←[0m @6m7pfofpb: Database 'default' is in an inconsistent state! ←[36m2015-05-20T13:35:43.412967+00:00 app[web.1]:←[0m [←[31merror←[0m] play - ERROR: type "double" does not exist ←[36m2015-05-20T13:35:43.412974+00:00 app[web.1]:←[0m Position: 320 [ERROR:0, SQLSTATE:42704] ←[36m2015-05-20T13:35:43.428889+00:00 app[web.1]:←[0m Oops, cannot start the server. ←[36m2015-05-20T13:35:43.429771+00:00 app[web.1]:←[0m at play.api.db.evolutions.Evolutions$.checkEvolutionsState(Evolutions.scala:196) ←[36m2015-05-20T13:35:43.429822+00:00 app[web.1]:←[0m at play.api.db.evolutions.Evolutions$.databaseEvolutions(Evolutions.scala:367) ←[36m2015-05-20T13:35:43.429871+00:00 app[web.1]:←[0m at play.api.db.evolutions.Evolutions$$anonfun$evolutionScript$2.apply(Evolutions.scala:332) ←[36m2015-05-20T13:35:43.429907+00:00 app[web.1]:←[0m at play.api.db.evolutions.Evolutions$$anonfun$evolutionScript$2.apply(Evolutions.scala:330) ←[36m2015-05-20T13:35:43.433005+00:00 app[web.1]:←[0m at scala.Option.map(Option.scala:145) ←[36m2015-05-20T13:35:43.433063+00:00 app[web.1]:←[0m at play.api.db.evolutions.Evolutions$.evolutionScript(Evolutions.scala:330) ←[36m2015-05-20T13:35:43.433140+00:00 app[web.1]:←[0m at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:486) ←[36m2015-05-20T13:35:43.433214+00:00 app[web.1]:←[0m at play.api.db.evolutions.EvolutionsPlugin.withLock(Evolutions.scala:531) ←[36m2015-05-20T13:35:43.433254+00:00 app[web.1]:←[0m at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:485) ←[36m2015-05-20T13:35:43.433294+00:00 app[web.1]:←[0m at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:483) ←[36m2015-05-20T13:35:43.433333+00:00 app[web.1]:←[0m at scala.collection.immutable.List.foreach(List.scala:383) ←[36m2015-05-20T13:35:43.433450+00:00 app[web.1]:←[0m at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:483) ←[36m2015-05-20T13:35:43.433528+00:00 app[web.1]:←[0m at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) ←[36m2015-05-20T13:35:43.433588+00:00 app[web.1]:←[0m at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) ←[36m2015-05-20T13:35:43.433638+00:00 app[web.1]:←[0m at scala.collection.immutable.List.foreach(List.scala:383) ←[36m2015-05-20T13:35:43.433676+00:00 app[web.1]:←[0m at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91) ←[36m2015-05-20T13:35:43.433728+00:00 app[web.1]:←[0m at play.api.Play$$anonfun$start$1.apply(Play.scala:91) ←[36m2015-05-20T13:35:43.433774+00:00 app[web.1]:←[0m at play.api.Play$$anonfun$start$1.apply(Play.scala:91) ←[36m2015-05-20T13:35:43.433809+00:00 app[web.1]:←[0m at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ←[36m2015-05-20T13:35:43.433864+00:00 app[web.1]:←[0m at play.api.Play$.start(Play.scala:90) ←[36m2015-05-20T13:35:43.433912+00:00 app[web.1]:←[0m at play.core.StaticApplication.(ApplicationProvider.scala:55) ←[36m2015-05-20T13:35:43.434109+00:00 app[web.1]:←[0m at play.core.server.NettyServer$.createServer(NettyServer.scala:244) ←[36m2015-05-20T13:35:43.434194+00:00 app[web.1]:←[0m at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:280) ←[36m2015-05-20T13:35:43.434302+00:00 app[web.1]:←[0m at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:275) ←[36m2015-05-20T13:35:43.434388+00:00 app[web.1]:←[0m at scala.Option.map(Option.scala:145) ←[36m2015-05-20T13:35:43.434467+00:00 app[web.1]:←[0m at play.core.server.NettyServer$.main(NettyServer.scala:275) ←[36m2015-05-20T13:35:43.434565+00:00 app[web.1]:←[0m at play.core.server.NettyServer.main(NettyServer.scala) ←[36m2015-05-20T13:35:44.389152+00:00 heroku[web.1]:←[0m State changed from starting to crashed ←[36m2015-05-20T13:35:44.376937+00:00 heroku[web.1]:←[0m Process exited with status 255
I especially do not understand this log line
00:00 app[web.1]:←[0m [←[31merror←[0m] play - ERROR: type "double" does not exist
Of course, I have some double attributes in some of my project class. Why is there an error on the double type?
Any advice/ideas more than welcome :)
EDIT 1
Here are the only two classes where I use the double
type.
Car
@Entity
public class Car extends Model{
@Id
@GeneratedValue
private int id;
@ManyToOne
@JoinColumn(name="user_fk")
private User user;
private String brand;
private String model;
@Column(unique = true)
private String licencePlate;
private String fuel;
private int nbSits;
@Column(name = "avg_cons", columnDefinition = "REAL")
private double avgCons; // Average consumption
@Column(name = "co2_cons", columnDefinition = "REAL")
private double co2Cons;
@Column(name = "htva_price", columnDefinition = "REAL")
private double htvaPrice;
@Column(name = "leasing_price", columnDefinition = "REAL")
private double leasingPrice;
@Column(columnDefinition = "REAL")
private double mileage;
@Column(columnDefinition = "REAL")
private boolean availability;
}
Transaction
@Entity
@Table(name = "transactions")
public class Transaction extends Model{
@Id
@GeneratedValue
private int id;
@OneToOne
@JoinColumn(name = "car_fk")
private Car car;
@OneToOne
@JoinColumn(name = "driver")
private User driver;
@Column(name = "from_date")
private Timestamp fromDate;
@Column(name = "to_date")
private Timestamp toDate;
@Column(name = "start_mileage", columnDefinition = "REAL")
private double startMileage;
@Column(name = "end_mileage", columnDefinition = "REAL")
private double endMileage;
@Column(columnDefinition = "REAL")
private double avgCons;
private String status;
private boolean exchange;
}
Upvotes: 0
Views: 295
Reputation: 3748
PostgreSQL works with column types double precision and does not know the column type double
I would suggest to try something like
@Column(columnDefinition = "NUMERIC")
private BigDecimal startMileage;
the value of the columnDefinition
is actually part of the DDL statement, that is why you should check your 1.sql to see what exactly is being generated (by Ebean)
Upvotes: 2