我尝试添加自定义转换器(logging.logback.SchemaNameConverter
)进行回溯配置,转换器使用Http.Context
。转换器放置在播放模块内。
java.lang.ClassNotFoundException: logging.logback.SchemaNameConverter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at controllers.Application.list3(Application.java:106)
at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$9$$anonfun$apply$9.apply(Routes.scala:349)
at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$9$$anonfun$apply$9.apply(Routes.scala:349)
at play.core.routing.HandlerInvokerFactory$$anon$4.resultCall(HandlerInvoker.scala:157)
at play.core.routing.HandlerInvokerFactory$$anon$4.resultCall(HandlerInvoker.scala:156)
at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$14$$anon$3$$anon$1.invocation(HandlerInvoker.scala:136)
at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:73)
at ActionCreator$1.call(ActionCreator.java:25)
at org.pac4j.play.java.SecureAction.lambda$null$1(SecureAction.java:106)
at org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:139)
at org.pac4j.play.java.SecureAction.lambda$internalCall$2(SecureAction.java:101)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
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)
从我最初的诊断来看,问题在于类加载器。主要应用程序使用ReloadableClassLoader(v1){file:.../target/scala-2.11/classes/}
加载类应用程序,其中logback使用PlayDependencyClassLoader
来加载其依赖项。由于转换器类在应用程序中,因此PlayDependencyClassLoader
加载程序找不到它。