gpt4 book ai didi

mongodb - Salat GRATER GLITCH ClassNotFoundException

转载 作者:可可西里 更新时间:2023-11-01 09:31:35 25 4
gpt4 key购买 nike

我在使用 Salat 时遇到了一个奇怪的问题,尤其是在我运行 Play 网络应用程序时会发生这种情况。

这是堆栈跟踪:

Caused by: java.util.concurrent.ExecutionException: Boxed Error
at scala.concurrent.impl.Promise$.resolver(Promise.scala:52) ~[scala-library.jar:na]
at scala.concurrent.impl.Promise$.scala$concurrent$impl$Promise$$resolveTry(Promise.scala:44) ~[scala-library.jar:na]
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:116) [scala-library.jar:na]
... 9 common frames omitted

引起:com.novus.salat.util.GraterGlitch:

  GRATER GLITCH - unable to find or instantiate a grater using supplied path name

REASON: Very strange! Path='domain.content.Exam' from pickled ScalaSig causes ClassNotFoundException

Context: 'global'
Path from pickled Scala sig: 'domain.content.Exam'



at com.novus.salat.Context$class.lookup(Context.scala:213) ~[salat-core_2.10-1.9.2.jar:1.9.2]
at com.novus.salat.global.package$$anon$1.lookup(global.scala:29) ~[salat-core_2.10-1.9.2.jar:1.9.2]
at com.novus.salat.package$.grater(package.scala:62) ~[salat-core_2.10-1.9.2.jar:1.9.2]
at com.novus.salat.dao.SalatDAO.<init>(SalatDAO.scala:48) ~[salat-core_2.10-1.9.2.jar:1.9.2]
at domain.content.ExamDAO$.<init>(Exam.scala:31) ~[classes/:na]
at domain.content.ExamDAO$.<clinit>(Exam.scala) ~[classes/:na]
at domain.content.Exam$.getAllExamsForTechnology(Exam.scala:22) ~[classes/:na]
at core.ContentService.allExamsForTechnology(ContentService.scala:30) ~[classes/:na]
at controllers.content.ExamController$$anonfun$allExamsForTechnology$1.apply(ExamController.scala:24) ~[classes/:na]
at controllers.content.ExamController$$anonfun$allExamsForTechnology$1.apply(ExamController.scala:22) ~[classes/:na]
at play.api.mvc.ActionBuilder$$anonfun$apply$10.apply(Action.scala:221) ~[play_2.10.jar:2.2.1]
at play.api.mvc.ActionBuilder$$anonfun$apply$10.apply(Action.scala:220) ~[play_2.10.jar:2.2.1]
at play.api.mvc.Action$.invokeBlock(Action.scala:357) ~[play_2.10.jar:2.2.1]
at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:309) ~[play_2.10.jar:2.2.1]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:109) ~[play_2.10.jar:2.2.1]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:109) ~[play_2.10.jar:2.2.1]
at play.utils.Threads$.withContextClassLoader(Threads.scala:18) ~[play_2.10.jar:2.2.1]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:108) ~[play_2.10.jar:2.2.1]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:107) ~[play_2.10.jar:2.2.1]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:107) ~[play_2.10.jar:2.2.1]
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:100) ~[play_2.10.jar:2.2.1]
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:481) ~[play-iteratees_2.10.jar:2.2.1]
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:481) ~[play-iteratees_2.10.jar:2.2.1]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:517) ~[play-iteratees_2.10.jar:2.2.1]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:517) ~[play-iteratees_2.10.jar:2.2.1]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$13.apply(Iteratee.scala:493) ~[play-iteratees_2.10.jar:2.2.1]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$13.apply(Iteratee.scala:493) ~[play-iteratees_2.10.jar:2.2.1]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) [scala-library.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) [scala-library.jar:na]
... 6 common frames omitted

出现这个奇怪错误的原因是什么?

最佳答案

我在 Play 2.4.x 中遇到了同样的问题。但是 sparkr 的解决方案还不够,因为 Play 会在每次代码更改时不断创建新的类加载器。以下 hack(在 Globals.scala 中)似乎解决了这个问题:

import play.api.{Play, Application, GlobalSettings}
import com.novus.salat.global.{ctx => SalatGlobalContext}

object Global extends GlobalSettings {
override def onStart(app: Application) = {
SalatGlobalContext.clearAllGraters()
SalatGlobalContext.registerClassLoader(Play.classloader(Play.current))
}
}

关于mongodb - Salat GRATER GLITCH ClassNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20715277/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com