在 Heroku 上使用 Play V2。在本地测试时一切正常,但是当我部署到 Heroku 并尝试保存到 PostgreSQL 数据库时,我收到以下错误。
在我的 Procfile 我有这个。
web: target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.postgresql.Driver
这是我的 Heroku 错误日志:
2012-04-03T18:16:05+00:00 app[web.1]: play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[PersistenceException: Error getting sequence nextval]]
2012-04-03T18:16:05+00:00 app[web.1]: ! @6a0gdoh95 - Internal server error, for request [POST /users] ->
2012-04-03T18:16:05+00:00 app[web.1]: at play.core.ActionInvoker$$anonfun$receive$1.a
2012-04-03T18:16:05+00:00 app[web.1]: [error] application -
2012-04-03T18:16:05+00:00 app[web.1]:
2012-04-03T18:16:05+00:00 app[web.1]:
2012-04-03T18:16:05+00:00 app[web.1]: at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:63) [play_2.9.1-2.0.jar:2.0]
2012-04-03T18:16:05+00:00 app[web.1]: at play.core.ActionInvoker.apply(Invoker.scala:61) [play_2.9.1-2.0.jar:2.0]
2012-04-03T18:16:05+00:00 app[web.1]: at com.avaje.ebean.config.dbplatform.SequenceIdGenerator.loadMoreIds(SequenceIdGenerator.java:163) ~[ebean-2.7.3.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at com.avaje.ebeaninternal.server.deploy.BeanDescriptor.nextId(BeanDescriptor.java:1218) ~[ebean-2.7.3.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at com.avaje.ebean.config.dbplatform.SequenceIdGenerator.getMoreIds(SequenceIdGenerator.java:213) ~[ebean-2.7.3.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at akka.actor.ActorCell.invoke(ActorCell.scala:617) [akka-actor-2.0.jar:2.0]
2012-04-03T18:16:05+00:00 app[web.1]: at com.avaje.ebeaninternal.server.persist.DefaultPersister.setIdGenValue(DefaultPersister.java:1304) ~[ebean-2.7.3.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:179) [akka-actor-2.0.jar:2.0]
2012-04-03T18:16:05+00:00 app[web.1]: at akka.actor.Actor$class.apply(Actor.scala:290) [akka-actor-2.0.jar:2.0]
2012-04-03T18:16:05+00:00 app[web.1]: at com.avaje.ebean.config.dbplatform.SequenceIdGenerator.nextId(SequenceIdGenerator.java:118) ~[ebean-2.7.3.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: Caused by: javax.persistence.PersistenceException: Error getting sequence nextval
2012-04-03T18:16:05+00:00 app[web.1]: at com.avaje.ebeaninternal.server.persist.DefaultPersister.insert(DefaultPersister.java:403) ~[ebean-2.7.3.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1810) ~[postgresql-8.4-702.jdbc4.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271) ~[postgresql-8.4-702.jdbc4.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077) ~[postgresql-8.4-702.jdbc4.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386) ~[postgresql-8.4-702.jdbc4.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: Caused by: org.postgresql.util.PSQLException: ERROR: relation "user_seq" does not exist
2012-04-03T18:16:05+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) ~[postgresql-8.4-702.jdbc4.jar:na]
2012-04-03T18:16:05+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498) ~[postgresql-8.4-702.jdbc4.jar:na]