heroku - 尝试将 Play framework 2.1.1 应用程序部署到 Heroku 时出错

标签 heroku playframework playframework-2.0

我有一个 play framework 2.1.1 java 应用程序,它在本地主机上运行良好。

我想把它部署到Heroku,所以我跟着these instructions

一切顺利,直到我输入这一行:

$ git push heroku master

当我在 CMD 中输入这一行时,最后出现以下错误:

remote:        [info] Compiling 1 Scala source to     /tmp/scala_buildpack_build_dir
/.sbt_home/plugins/target/scala-2.9.2/sbt-0.12/classes...
remote:        [error] error while loading CharSequence, class file     '/tmp/scala_
buildpack_build_dir/.jdk/jre/lib/rt.jar(java/lang/CharSequence.class)' is     broken

remote:        [error] (bad constant pool tag 18 at byte 10)
remote:        [error] error while loading Comparator, class file     '/tmp/scala_bu
ildpack_build_dir/.jdk/jre/lib/rt.jar(java/util/Comparator.class)' is broken
remote:        [error] (bad constant pool tag 18 at byte 20)
remote:        [error] two errors found
remote:        [error] (compile:compile) Compilation failed
remote:        Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
remote:  !     ERROR: Failed to run sbt!
remote:        We're sorry this build is failing! If you can't find the     issue in
 application
remote:        code, please submit a ticket so we can help:     https://help.heroku.
com
remote:        You can also try reverting to the previous version of the     buildpa
ck by running:
remote:        $ heroku buildpacks:set https://github.com/heroku/heroku-    buildpac
k-scala#previous-version
remote:
remote:        Thanks,
remote:        Heroku
remote:
remote:
remote:  !     Push rejected, failed to compile Play 2.x - Java app
remote:
remote: Verifying deploy....
remote:
remote: !       Push rejected to project.
remote:
To https://git.heroku.com/project.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/project.git'

我真的不知道该怎么办,有人能帮帮我吗?

谢谢

最佳答案

看起来您正在尝试部署一个使用不支持 Java 8 的 Scala 2.9 的应用程序。但 Java 8 是 Heroku 上的默认设置。

尝试在您的应用程序的根目录中添加一个 system.properties 文件,并将以下代码放入其中:

java.runtime.version=1.7

然后将文件添加到您的 Git 存储库并像这样重新部署:

$ git add system.properties
$ git commit -m "Set JDK version to 7"
$ git push heroku master

关于heroku - 尝试将 Play framework 2.1.1 应用程序部署到 Heroku 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31549605/

相关文章:

ruby-on-rails - 在 Heroku 上使用 Thin 和 SSL 的 Rails 应用程序(Procfile)

java - 在 .xml.scala 模板中将 Scala 字符串转换为 Xml

scala - 方法映射的参数太多 : (apply: (String, models.Address) => R)(unapply : R => Option[(String, models.Address)])play.api.data.Mapping[R]

java - Play 2.0.4 : Any chance to set followRedirects to false in WS. Java Controller 中有响应?

python - 如何在 Heroku 中运行命令行 python 工具

Heroku 上 Spring Boot 应用程序的 MongoDB 连接

Scala玩Guice注入(inject)

java - 清理基于 Play-framework 的项目

java - 如何禁用 Play 2.6 CSRFFilter

ssl - Heroku 自定义域 SSL 警告