我们刚刚迁移到玩2.5.18。 代码更改已完成,但升级后,JVM将因以下错误而关闭。 知道这是什么意思吗?已经一个礼拜了,我一直坚持下去。
[info] play.api.Play - Application started (Dev)
Uncaught error from thread [application-akka.actor.default-dispatcher-6]: play/libs/F$Function, shutting down JVM since ‘akka.jvm-exit-on-fatal-error’ is enabled for for ActorSystem[application]
java.lang.NoClassDefFoundError: play/libs/F$Function
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405)
at play.core.j.DefaultJavaHandlerComponents.getAction(JavaAction.scala:142)
at play.core.j.JavaAction$$anonfun$6.apply(JavaAction.scala:91)
at play.core.j.JavaAction$$anonfun$6.apply(JavaAction.scala:89)
at scala.collection.IndexedSeqOptimized$class.foldl(IndexedSeqOptimized.scala:57)
at scala.collection.IndexedSeqOptimized$class.foldLeft(IndexedSeqOptimized.scala:66)
at scala.collection.mutable.ArraySeq.foldLeft(ArraySeq.scala:46)
at play.core.j.JavaAction.apply(JavaAction.scala:89)
at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:111)
at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:110)
at scala.Option.map(Option.scala:146)
at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:110)
at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:103)
at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91)
at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:415)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
根据要求,我正在添加我的application.conf 我的application.conf文件如下:
play.crypto.secret = "xyz"
# The application languages
# ~~~~~
application.langs = "en"
# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
#application.global = Global
play.application.loader = "CustomApplicationLoader"
# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `conf/my.application.Router`,
# you may need to define a router file `my.application.routes`.
# Default to Routes in the root package (and `conf/routes`)
play.http.router = x.Routes
play.http.context = "/x/v1"
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=""
#
# You can expose this datasource via JNDI if needed (Useful for JPA)
# db.default.jndiName=DefaultDS
evolutionplugin = disabled
play.http.parser.maxMemoryBuffer = 512k
ebean.x = "models.ebean.x.*"
logger.file = logback.xml
include "re.constants.conf"
include "akka.conf"
include "metering.conf"
include "basicAuth.conf"
include "cache.conf"
include "awsS3bucketCredentials.conf"
play.evolutions.enabled=false
play.modules.disabled += "play.api.db.evolutions.EvolutionsModule"
Module.java看起来像这样:
public class Module extends AbstractModule {
@Override
protected void configure() {
bind(StartUpHandler.class).asEagerSingleton();
}
}
StartupHandler.java看起来像这样:
@Singleton
public class StartUpHandler {
private Injector injector;
@Inject
public StartUpHandler() {
injector = Guice.createInjector(new ControllersModule(), new ServicesModule(), new RepositoryModule());
/*Some code*/
}
CustomApplicationLoader看起来像这样:
public class CustomApplicationLoader extends GuiceApplicationLoader {
@Override
public GuiceApplicationBuilder builder(ApplicationLoader.Context context) {
Logger.error("GuiceApplicationBuilder builder");
Configuration updatedConfig = context.initialConfiguration();
File file = new File(".");
String mode = updatedConfig.getString("mode");
if (StringUtils.isNotEmpty(mode)) {
try {
File modeFolder = FileUtils.getFile(file, "conf/" + mode);
if (modeFolder.exists()) {
play.api.Configuration modeConfig = context.initialConfiguration().getWrappedConfiguration();
IOFileFilter fileFilter = new WildcardFileFilter("*.conf");
Collection<File> fileList = FileUtils.listFiles(modeFolder, fileFilter, null);
for (File confFile : fileList) {
modeConfig = modeConfig
.$plus$plus(new play.api.Configuration(ConfigFactory.parseFile(confFile)));
}
updatedConfig = new Configuration(modeConfig);
Logger.error("Folder: " + modeFolder);
}
} catch (Exception e) {
Logger.error("GLOBAL: Exception while loading configuration for mode : " + mode, e);
}
} else {
Logger.error("GLOBAL: Please provide mode in which play application has to start (Ex. play -Dmode=<mode>) ");
}
return initialBuilder
.in(context.environment())
.loadConfig(updatedConfig)
.overrides(overrides(context));
}