I'm trying to test out my app before deploying it on Heroku. I've added the sbt start script to my plugins.sbt:
addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.8.0")
And I have a Procfile
containing:
web: target/start Web -Dhttp.port=$PORT
When I run the sbt stage
task, it generates the start script in target/start
which points to the "main" class of my project, in the form of com.somepackage.mainclass.
When I run foreman start
though, it immediately fails with:
08:34:51 web.1 | Exception in thread "main" java.lang.NoClassDefFoundError: foo/launch/MainApp 08:34:51 web.1 | Caused by: java.lang.ClassNotFoundException: foo.launch.MainApp 08:34:51 web.1 | at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 08:34:51 web.1 | at java.security.AccessController.doPrivileged(Native Method) 08:34:51 web.1 | at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 08:34:51 web.1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 08:34:51 web.1 | at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 08:34:51 web.1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 08:34:51 web.1 | exited with code 1 08:34:51 system | sending SIGTERM to all processes
I've tried sbt clean compile stage several times, but it doesn't seem to help. Neither does moving the main class to a different package or even to the default package, i.e. src/main/scala.