Can't start the Play Framework application

802 Views Asked by At

I am using 2.5.x play framework and here is my application.conf

play.http.secret.key="changeme"
play.i18n.langs = [ "en", "en-US", "fr" ]
.....
.....

When I am trying to run the application using following command

go-1.1/bin/go -Dplay.http.secret.key=abcdefghij -Dhttp.port=9999

It's throwing me an error:

at play.api.libs.crypto.CryptoConfigParser.get$lzycompute(Crypto.scala:498)
at play.api.libs.crypto.CryptoConfigParser.get(Crypto.scala:465)
at play.api.libs.crypto.CryptoConfigParser.get(Crypto.scala:463)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)

....

If I am checking crypto.scala:498 then it's clearly saying "Application secret key is not found". I am already providing the key in command line and applicaiton.conf. What is wrong with it?

2

There are 2 best solutions below

4
ACO On

What we usually do is using a config file for production

add a prod.conf file in /conf

# this include all your standard configuration
include "application.conf"

# you override this key
play.http.secret.key=abcdefghij

for production run with -Dconfig.file=conf/prod.conf

0
amezdari On

You must to change your secret key, "abcdefghij" is by default but play not allow to keep this value of secret key. you can put what you want.