Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala Play 2.2 application crashes after deploying in Heroku: target/start No such file or directory

I've been fighting with this for hours and I can't figure out why after deploying my Scala Play 2.2 application in Heroku I get this stacktrace:

2013-09-30T01:05:09.413177+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=18174 $PLAY_OPTS`
2013-09-30T01:05:10.931893+00:00 app[web.1]: bash: target/start: No such file or directory
2013-09-30T01:05:12.382399+00:00 heroku[web.1]: Process exited with status 127
2013-09-30T01:05:12.414050+00:00 heroku[web.1]: State changed from starting to crashed

I've tried several Procfile versions with no success, some examples are:

web: target/start -Dhttp.port=$PORT

web: target/start -Dhttp.port=$PORT $PLAY_OPTS

web: target/start -Dhttp.port=$PORT $JAVA_OPTS

web: target/start Web -Dhttp.port=$PORT $PLAY_OPTS

web: target/start -Dhttp.port=$PORT $PLAY_OPTS -Dconfig.file=application.conf

web: target/start -Dhttp.port=$PORT $PLAY_OPTS -Dconfig.file=conf/application.conf

I even tried using no Procfile.

I'm using Scala 2.10.2 and Play 2.2. In the same Heroku application I had a previous version of my project running on Play 2.0, I don't know if that is related.

The application works perfect locally. I connected to the bash in Heroku and run

sbt clean
sbt stage

by hand and I checked that the target gets cleaned and built again.

What does the "target/start: No such file or directory" refer to? To the target? To the start command? To something else?

like image 793
Carla Avatar asked Sep 30 '13 01:09

Carla


3 Answers

Play 2.2 changed the name and location of the file used to start your app

http://www.playframework.com/documentation/2.2.x/Production

For example, to start an application of the project ‘foo’ from the project folder, update your Procfile to run:

target/universal/stage/bin/foo
like image 80
S-C Avatar answered Nov 10 '22 17:11

S-C


See Deploy to Heroku, especially Connecting to a database section.

like image 39
krispo Avatar answered Nov 10 '22 18:11

krispo


I solved it as follows (possibly already answered but here are my steps)

$ heroku local web

Got the following output in the console

forego | starting web.1 on port 5000
web.1  | /bin/bash: target/bin/Service: Permission denied

Then I did

$chmod 777 target/bin/Service

and problem resolved.

Here, Service is the name of my application (as specified in pom.xml org.codehaus.mojo plugin) and here is what my Procfile file content looks like

web: target/bin/Service -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL}
like image 2
NRA Avatar answered Nov 10 '22 18:11

NRA