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

3

6

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 ?

Colubrid answered 1/6, 2018 at 5:13 Comment(0)
C
2

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
Cuellar answered 19/7, 2019 at 14:56 Comment(0)
T
0

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

Tombstone answered 1/6, 2018 at 5:58 Comment(2)
What should be the value of play.server.dir ? is there no way to run it in command line ? I can use "run" command in my IDE to run the play java project but same jar not running in IDE terminal ?Colubrid
There likely is a way to run it just from command line. But I couldn't find out how exactly. All the instructions had various other methodsTombstone
I
0

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.

Inevitable answered 3/6, 2022 at 11:30 Comment(1)
I've got to say it still doesn't work for me. I'll update my answer if I can get it working.Inevitable

© 2022 - 2024 — McMap. All rights reserved.