我无法使用PostgreSQL数据库在Heroku上正确部署Play Frmaework app
(Java)。
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的日志:
←[36m2015-05-20T13:35:43.429517 + 00:00 app [web.1]:←[0m @ 6m7pfofpb: 数据库'默认'处于不一致的状态! ←[36m2015-05-20T13:35:43.412967 + 00:00 app [web.1]:←[0m [←[31merror←[0m] play - ERROR:type" double"不存在 ←[36m2015-05-20T13:35:43.412974 + 00:00 app [web.1]:←[0m位置:320 [错误:0,SQLSTATE:42704]←[36m2015-05-20T13:35:43.428889 + 00:00 app [web.1]:←[0m哎呀,无法启动服务器。 ←[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.适用(Evolutions.scala:332) ←[36m2015-05-20T13:35:43.429907 + 00:00 app [web.1]:←[0m at play.api.db.evolutions.Evolutions $$ anonfun $ evolutionScript $ 2.适用(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 $ $应用$ 1.适用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.适用(Evolutions.scala:485) ←[36m2015-05-20T13:35:43.433294 + 00:00 app [web.1]:←[0m at play.api.db.evolutions.EvolutionsPlugin $$ anonfun $ $调用onStart 1.适用(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 $开始$ 1 $$ anonfun $ $应用MCV $ SP $ 1.适用(Play.scala:91) ←[36m2015-05-20T13:35:43.433588 + 00:00 app [web.1]:←[0m at play.api.Play $$ anonfun $开始$ 1 $$ anonfun $ $应用MCV $ SP $ 1.适用(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 $开始$ 1.适用$ MCV $ SP(Play.scala:91) ←[36m2015-05-20T13:35:43.433728 + 00:00 app [web.1]:←[0m at play.api.Play $$ anonfun $开始$ 1.适用(Play.scala:91) ←[36m2015-05-20T13:35:43.433774 + 00:00 app [web.1]:←[0m at play.api.Play $$ anonfun $开始$ 1.适用(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 $。开始(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 $主$ 3.apply(NettyServer.scala:280) ←[36m2015-05-20T13:35:43.434302 + 00:00 app [web.1]:←[0m at play.core.server.NettyServer $$ anonfun $主$ 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 $。主要(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状态已更改 从开始坠毁←[36m2015-05-20T13:35:44.376937 + 00:00 heroku [web.1]:←[0m进程已退出,状态为255
我特别不明白这条日志行
<00> 00:00 app [web.1]:←[0m [←[31merror←[0m] play - ERROR:type&#34; double&#34; 不存在
当然,我的一些项目类中有一些双重属性。为什么double类型有错误?
任何建议/想法超过欢迎:)
编辑1
以下是我使用double
类型的唯一两个类。
的车
@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;
}
交易
@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;
}
答案 0 :(得分:2)
PostgreSQL使用列类型双精度,并且不知道列类型 double
我建议尝试类似
的内容@Column(columnDefinition = "NUMERIC")
private BigDecimal startMileage;
columnDefinition
的值实际上是DDL语句的一部分,这就是为什么你应该检查你的1.sql以查看究竟是在生成什么(通过Ebean)