Search code examples
javaplayframeworksbtplayframework-2.3sbt-native-packager

Starting play server with activator throw an application.conf not found error


I have a very strange problem.

I'm creating a server with play 2.3. when I launch it with activator run, it works perfectly. But if I use activator start to launch the server in deployement mode, I'm getting an IOException: file not found for application.conf.

Configuration error: Configuration error[application: application.conf: java.io.IOException: resource not found on classpath: application.conf, application.json: java.io.IOException: resource not found on classpath: application.json, application.properties: java.io.IOException: resource not found on classpath: application.properties]

When I run activator windows:packageBin it give me a warning about evicted library :

[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn]  * com.typesafe.sbt:sbt-native-packager:0.7.4 -> 1.0.3
[warn] Run 'evicted' to see detailed eviction warnings

The strange thing is that it have been working few month ago...

Here is my build.sbt file :

name := """IdTabDriver"""
version := "1.0.0.1"

name in Windows := "IdTabDriver"

//packageSummary in Windows := "IdTabDriver"

//packageDescription in Windows := "IdTabDriver"

maintainer in Windows := "Access France"

organization := "Access France"

lazy val root = (project in file(".")).enablePlugins(PlayJava).enablePlugins(JavaAppPackaging)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  cache,
  javaWs,
  "commons-configuration" % "commons-configuration" % "1.10",
  "org.rxtx" % "rxtxcomm" % "2.0-7pre1"
)

And my plugin.sbt file :

resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3")

EDIT : I have use the -Dconfig.file=conf/application.conf option to solve the previous exception, but I get a new one

Configuration error: Configuration error[Cannot initialize the custom Global object (controllers.Global) (perhaps it's a wrong reference?)]

Solution

  • The problem you have is well known #499, #554 and on play #4242.

    Playframework 2.3.x doesn't use AutoPlugins all the way through. This causes strange issues when you mix AutoPlugins (sbt-native-packager 1.0.3) and non-AutoPlugin builds (like play 2.3.x).

    Furthermore you are using the JavaAppPackaging archetype, but play already enables the JavaServerAppPackaging archetype. This may also cause some strange behaviors like yours.

    So the solution would be

    • upgrade play 2.3.x to 2.4.x
    • OR downgrade sbt-native-packager to 0.8.x

    You may also look at our docs for play