Search code examples
githerokuplayframeworksbttypesafe-activator

Error deploying Play Framework 2.4 on Heroku


I am trying to deploy a Play Framework (Java) Application (v 2.4) on Heroku, but when I excute the command git push heroku master I get the following exception:

remote:        [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
remote:        [warn]   ::          UNRESOLVED DEPENDENCIES         ::
remote:        [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
remote:        [warn]   :: com.typesafe.sbtrc#client-2-11;0.3.1: not found
remote:        [warn]   :: com.typesafe.sbtrc#actor-client-2-11;0.3.1: not found
remote:        [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
remote:        [warn]
remote:        [warn]   Note: Unresolved dependencies path:
remote:        [warn]           com.typesafe.sbtrc:client-2-11:0.3.1
remote:        [warn]             +- com.typesafe.play:fork-run-protocol_2.11:2.4.3 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
remote:        [warn]             +- com.typesafe.play:fork-run_2.11:2.4.3 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
remote:        [warn]             +- escarbajo:escarbajo_2.11:1.0-SNAPSHOT
remote:        [warn]           com.typesafe.sbtrc:actor-client-2-11:0.3.1
remote:        [warn]             +- com.typesafe.play:fork-run_2.11:2.4.3 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
remote:        [warn]             +- escarbajo:escarbajo_2.11:1.0-SNAPSHOT
remote:        sbt.ResolveException: unresolved dependency: com.typesafe.sbtrc#client-2-11;0.3.1: not found
remote:        unresolved dependency: com.typesafe.sbtrc#actor-client-2-11;0.3.1: not found
remote:         at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291)
remote:         at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188)
remote:         at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165)
remote:         at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
remote:         at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
remote:         at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
remote:         at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
remote:         at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
remote:         at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
remote:         at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
remote:         at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
remote:         at xsbt.boot.Using$.withResource(Using.scala:10)
remote:         at xsbt.boot.Using$.apply(Using.scala:9)
remote:         at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
remote:         at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
remote:         at xsbt.boot.Locks$.apply0(Locks.scala:31)
remote:         at xsbt.boot.Locks$.apply(Locks.scala:28)
remote:         at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
remote:         at sbt.IvySbt.withIvy(Ivy.scala:127)
remote:         at sbt.IvySbt.withIvy(Ivy.scala:124)
remote:         at sbt.IvySbt$Module.withModule(Ivy.scala:155)
remote:         at sbt.IvyActions$.updateEither(IvyActions.scala:165)
remote:         at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1369)
remote:         at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1365)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1399)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1397)
remote:         at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1402)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1396)
remote:         at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
remote:         at sbt.Classpaths$.cachedUpdate(Defaults.scala:1419)
remote:         at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1348)
remote:         at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1310)
remote:         at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
remote:         at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
remote:         at sbt.std.Transform$$anon$4.work(System.scala:63)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
remote:         at sbt.Execute.work(Execute.scala:235)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
remote:         at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
remote:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
remote:         at java.lang.Thread.run(Thread.java:745)
remote:        [error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.sbtrc#client-2-11;0.3.1: not found
remote:        [error] unresolved dependency: com.typesafe.sbtrc#actor-client-2-11;0.3.1: not found
remote:        [error] Total time: 20 s, completed Oct 24, 2015 9:02:27 PM
remote:
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 buildpack by running:
remote:        $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-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 protected-lowlands-4290.
remote:
To https://git.heroku.com/protected-lowlands-4290.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/protected-lowlands-4290.git'

I have searched all over for solutions and I have found some things that work for others but it has not worked in this case. I've tried the following:

  1. Add the line project/play-fork-run.sbt to the .gitignore file.
  2. Delete the file play-fork-run.sbt.
  3. Add these resolvers to the build.stb file: resolvers += Resolver.url("Typesafe Ivy", url("http://repo.typesafe.com/typesafe/ivy-snapshots"))(Resolver.ivyStylePatterns) resolvers += "Typesafe" at "http://repo.typesafe.com/typesafe/releases/"

But nothing seems to work, when I compile and run the application on localhost, it works perfectly.

Any ideas to solve this problem?

Any help is really appreciated!

Thanks


Solution

  • The reason this works on localhost is that you've probably run activator at some point, which downloaded the offending dependency to your local .ivy2 cache. But on Heorku, only sbt runs, and there is a major bug in activator that has not been fixed for a long time that results in different resolvers between activator and sbt.

    It sounds like you've already come across these reports, which contain some suggestions (mostly what you've already tried):

    The underlying problem is a dependency on this:

    addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.4.3")
    

    Double check all of your sbt files under project/ to make sure this dependency is not in any of them. Also make sure your Git repository changes have been committed before you push to Heroku.

    Finally, if you're still stuck, you could switch to use the sbt-heroku plugin, which uses locally compiled assets and deploys them to Heroku. This will avoid the problem all together.

    Also, I recommend you bring this up on the Play mailing list. This is a long standing problem, and I've met tons of people who've encountered it. The folks at Typesafe need to hear from their users about how rampant this is.