Closed hedecai closed 2 years ago
@hedecai Why do you add the shutdown hook? AFAIK Play actually already does takes care of that and shuts down logback.
Actually I also think this problem is a classloder problem, probably only occuring in dev mode.
@mkurz From the play document https://www.playframework.com/documentation/2.8.x/SettingsLogger the play production default configuration has a shutdownHook. Remove the shutdownHook from config is ok?
Remove the shutdownHook from config is ok?
Yes, absolutely. Actually you definitely should remove it from you config. It makes things even worse, that's why I will remove it from the documentation, see https://github.com/playframework/playframework/pull/11532
Why there is a NoClassDefFoundError
is a different story, which I have no answer to right now. Either it's related to https://github.com/playframework/playframework/pull/10939 or the sbt play-ebean plugin messes around with the classloader too much (looking at https://github.com/playframework/play-ebean/blob/6.2.x/sbt-play-ebean/src/main/scala-sbt-1.0/play/ebean/sbt/PlayEbean.scala it does set/unset the classloader and other kung-fu) Anyway, I will not look into this.
So your problem is solved by just not adding <shutdownHook />
to your config.
We create a java play project with
sbt new playframework/play-java-seed.g8
Then we add play-ebean as dependency in project/plugins.sbt
and build.sbt
Add shutdown hook in logback.xml
When the project process one request and we press Enter to stop the project got this exception.
Thanks.