2015-07-21 64 views
3

我有一個玩框架2.1.1 Java應用程序,它在本地主機上運行良好。嘗試部署Play框架2.1.1應用程序到Heroku時出錯

我想將它部署到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' 

我真的不知道該怎麼做,任何人都可以幫助我嗎?

感謝

回答

4

它看起來像你想部署使用的Scala 2.9的應用程序,它不支持Java 8.但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 
+0

它的工作!謝謝。 – 3289321783

相關問題