I got this error running Play 2.4 server in production mode:
play.api.UnexpectedException: Unexpected exception[ProvisionException: Unable to provision, see the following errors:
1) Error in custom provider, @6mh5cjo5l: Configuration error
while locating play.api.libs.CryptoConfigParser
while locating play.api.libs.CryptoConfig
...
Caused by: play.api.PlayException: Configuration error[Application secret not set]
How to fix?
The default Play template uses the following:
play.crypto.secret="changeme"
in the application.conf
which needs to be changed for use in production. Play provides an utility to generate a random secret for you:
./activator playGenerateSecret
with which you can then populate as an environment variable:
APPLICATION_SECRET=...
and in conf/application.conf
ensure the following:
play.crypto.secret="changeme"
play.crypto.secret=${?APPLICATION_SECRET}
which as the Play documentation explains:
The second line in that configuration sets the secret to come from an environment variable called APPLICATION_SECRET if such an environment variable is set, otherwise, it leaves the secret unchanged from the previous line.
Then the error will go away.