Error while trying to deploy Play Framework 2.1.1 app to Heroku

I got java app play framework 2.1.1, it works fine on localhost.

I want to deploy it to Heroku, so I followed these instructions

Everything is going well until I enter this line:

$ git push heroku master

      

When I enter this line into CMD, I get the following error at the end:

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'

      

I really don't know what to do, can anyone help me?

thank

+3


source to share


1 answer


It looks like you are trying to deploy an application that uses Scala 2.9, which does not support Java 8. But Java 8 is the default on Heroku.

Try adding the system.properties file to the root directory of your application and put the following code in it:

java.runtime.version=1.7

      



Then add the file to your Git repository and redeploy as follows:

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

      

+4


source







All Articles