Bharat
Bharat

Reputation: 311

Play Framework sbt assembly jar running error :- "No root server path supplied"

I built play framework project jar with sbt assembly command. when I run the jar with Java -jar "jarName.jar" it throws error "No root server path supplied" any suggestions ?

Upvotes: 6

Views: 2102

Answers (3)

Daniel Darabos
Daniel Darabos

Reputation: 27456

Since version 2.7 the Play documentation has a section on Using the sbt assembly plugin, albeit "not officially supported".

The key part is using MergeStrategy.concat for reference-overrides.conf files. I also had to do the same for reference.conf files.

Upvotes: 0

user2241239
user2241239

Reputation:

I got the same problem when I build a fat jar of my project with this plugin:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

and using

sbt assembly

and running it with

java -jar .\myproject-assembly-1.0.jar

This went away when I used:

sbt dists

it will create a zip file containing your application in:

\target\universal\myproject-1.0.zip

copy this file to the server where you want to run it, unpack, then go to the bin directory and run the script, it worked for me:

Linux  : bin\myproject 
Windows: bin\myproject.bat

Upvotes: 2

Ryan Leach
Ryan Leach

Reputation: 4470

https://github.com/playframework/playframework/blob/master/framework/src/play-server/src/main/scala/play/core/server/ProdServerStart.scala#L91

val rootDir: File = {
  val path = configuration.getOptional[String]("play.server.dir")
    .getOrElse(throw ServerStartException("No root server path supplied"))

Shows that the playframework requires a configuration string play.server.dir to be set before it will run.

This is likely happening because you are just running the jar on the command line, or have not followed the deployment / build instructions, or maybe because there is no default configuration defined.

Play deployment instructions can be found here: https://www.playframework.com/documentation/2.6.x/Deploying#Deploying-your-application

Upvotes: 0

Related Questions