java.lang.NoClassDefFoundError: Could not initialize class play.twirl.compiler.TwirlCompiler$TemplateAs

分享 未结
0 0 3 9
yangmingsen 2019-02-16发布
收藏 点赞

我刚刚从Play那下载一个hello-world项目

sbt run 后 报这个异常是什么问题?

[error] java.lang.NoClassDefFoundError: Could not initialize class play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$
[error] 	at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$.getFunctionMapping(TwirlCompiler.scala:425)
[error] 	at play.twirl.compiler.TwirlCompiler$.generateCode(TwirlCompiler.scala:326)
[error] 	at play.twirl.compiler.TwirlCompiler$.generateFinalTemplate(TwirlCompiler.scala:377)
[error] 	at play.twirl.compiler.TwirlCompiler$.parseAndGenerateCode(TwirlCompiler.scala:206)
[error] 	at play.twirl.compiler.TwirlCompiler$.compile(TwirlCompiler.scala:174)
[error] 	at play.twirl.sbt.TemplateCompiler$.$anonfun$compile$2(TemplateCompiler.scala:42)
[error] 	at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:788)
[error] 	at scala.collection.immutable.List.foreach(List.scala:388)
[error] 	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:787)
[error] 	at play.twirl.sbt.TemplateCompiler$.compile(TemplateCompiler.scala:39)
[error] 	at play.twirl.sbt.SbtTwirl$.$anonfun$compileTemplatesTask$1(SbtTwirl.scala:108)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:278)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (Compile / twirlCompileTemplates) java.lang.NoClassDefFoundError: Could not initialize class play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$
[error] a.a.ActorSystemImpl - Internal server error, sending 500 response
akka.http.impl.util.One2OneBidiFlow$OutputTruncationException: Inner flow was completed without producing result elements for 1 outstanding elements
	at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
	at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
	at akka.http.impl.util.One2OneBidiFlow$One2OneBidi$$anon$1$$anon$4.onUpstreamFinish(One2OneBidiFlow.scala:97)
	at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:504)
	at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:378)
	at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:588)
	at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:472)
	at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:563)
	at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:745)
	at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:760)


回帖
  • 2019-02-16

    Sbt版本和Play版本分别是多少?可能是不匹配导致的

    0 回复
  • 2019-02-17

    @小编 我的sbt是1.2.8 ,play项目是在play社区下载的 

    0 回复
  • 2019-02-17

    @小编 是在服务启动后 访问localhost:9000 出现的

    G:\Project\Scala\Play\play-scala-starter-example>sbt run
    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
    [info] Loading settings for project play-scala-starter-example-build from plugins.sbt ...
    [info] Loading project definition from G:\Project\Scala\Play\play-scala-starter-example\project
    [info] Loading settings for project root from build.sbt ...
    [info] Set current project to play-scala-starter-example (in build file:/G:/Project/Scala/Play/play-scala-starter-example/)
    
    --- (Running the application, auto-reloading is enabled) ---
    
    [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
    
    (Server started, use Enter to stop and go back to the console...)
    
    访问后出现下面
    
    [error] java.lang.ExceptionInInitializerError
    [error]         at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$.getFunctionMapping(TwirlCompiler.scala:425)
    [error]         at play.twirl.compiler.TwirlCompiler$.generateCode(TwirlCompiler.scala:326)
    [error]         at play.twirl.compiler.TwirlCompiler$.generateFinalTemplate(TwirlCompiler.scala:377)
    [error]         at play.twirl.compiler.TwirlCompiler$.parseAndGenerateCode(TwirlCompiler.scala:206)
    [error]         at play.twirl.compiler.TwirlCompiler$.compile(TwirlCompiler.scala:174)
    [error]         at play.twirl.sbt.TemplateCompiler$.$anonfun$compile$2(TemplateCompiler.scala:42)
    [error]         at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:788)
    [error]         at scala.collection.immutable.List.foreach(List.scala:388)
    [error]         at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:787)
    [error]         at play.twirl.sbt.TemplateCompiler$.compile(TemplateCompiler.scala:39)
    [error]         at play.twirl.sbt.SbtTwirl$.$anonfun$compileTemplatesTask$1(SbtTwirl.scala:108)
    [error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
    [error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
    [error]         at sbt.std.Transform$$anon$4.work(System.scala:67)
    [error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
    [error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
    [error]         at sbt.Execute.work(Execute.scala:278)
    [error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
    [error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
    [error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    [error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    [error]         at java.lang.Thread.run(Thread.java:748)
    [error] Caused by: java.lang.NullPointerException
    [error]         at java.util.Arrays.sort(Arrays.java:1438)
    [error]         at scala.tools.nsc.classpath.JFileDirectoryLookup.listChildren(DirectoryClassPath.scala:116)
    [error]         at scala.tools.nsc.classpath.JFileDirectoryLookup.listChildren$(DirectoryClassPath.scala:100)
    [error]         at scala.tools.nsc.classpath.DirectoryClassPath.listChildren(DirectoryClassPath.scala:283)
    [error]         at scala.tools.nsc.classpath.DirectoryClassPath.listChildren(DirectoryClassPath.scala:283)
    [error]         at scala.tools.nsc.classpath.DirectoryLookup.list(DirectoryClassPath.scala:76)
    [error]         at scala.tools.nsc.classpath.DirectoryLookup.list$(DirectoryClassPath.scala:72)
    [error]         at scala.tools.nsc.classpath.DirectoryClassPath.list(DirectoryClassPath.scala:283)
    [error]         at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$list$1(AggregateClassPath.scala:76)
    [error]         at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
    [error]         at scala.collection.Iterator.foreach(Iterator.scala:937)
    [error]         at scala.collection.Iterator.foreach$(Iterator.scala:937)
    [error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
    [error]         at scala.collection.IterableLike.foreach(IterableLike.scala:70)
    [error]         at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
    [error]         at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
    [error]         at scala.collection.TraversableLike.map(TraversableLike.scala:233)
    [error]         at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
    [error]         at scala.collection.AbstractTraversable.map(Traversable.scala:104)
    [error]         at scala.tools.nsc.classpath.AggregateClassPath.list(AggregateClassPath.scala:74)
    [error]         at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:271)
    [error]         at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:220)
    [error]         at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1530)
    [error]         at scala.reflect.internal.Mirrors$RootsBase.init(Mirrors.scala:225)
    [error]         at scala.tools.nsc.Global.rootMirror$lzycompute(Global.scala:65)
    [error]         at scala.tools.nsc.Global.rootMirror(Global.scala:63)
    [error]         at scala.tools.nsc.Global.rootMirror(Global.scala:36)
    [error]         at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:287)
    [error]         at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:287)
    [error]         at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1454)
    [error]         at scala.tools.nsc.Global$Run.<init>(Global.scala:1179)
    [error]         at scala.tools.nsc.interactive.Global$TyperRun.<init>(Global.scala:1314)
    [error]         at scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:1337)
    [error]         at scala.tools.nsc.interactive.Global.<init>(Global.scala:286)
    [error]         at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$CompilerInstance.compiler$lzycompute(TwirlCompiler.scala:507)
    [error]         at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$CompilerInstance.compiler(TwirlCompiler.scala:481)
    [error]         at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$.<init>(TwirlCompiler.scala:549)
    [error]         at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$.<clinit>(TwirlCompiler.scala)
    [error]         at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$.getFunctionMapping(TwirlCompiler.scala:425)
    [error]         at play.twirl.compiler.TwirlCompiler$.generateCode(TwirlCompiler.scala:326)
    [error]         at play.twirl.compiler.TwirlCompiler$.generateFinalTemplate(TwirlCompiler.scala:377)
    [error]         at play.twirl.compiler.TwirlCompiler$.parseAndGenerateCode(TwirlCompiler.scala:206)
    [error]         at play.twirl.compiler.TwirlCompiler$.compile(TwirlCompiler.scala:174)
    [error]         at play.twirl.sbt.TemplateCompiler$.$anonfun$compile$2(TemplateCompiler.scala:42)
    [error]         at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:788)
    [error]         at scala.collection.immutable.List.foreach(List.scala:388)
    [error]         at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:787)
    [error]         at play.twirl.sbt.TemplateCompiler$.compile(TemplateCompiler.scala:39)
    [error]         at play.twirl.sbt.SbtTwirl$.$anonfun$compileTemplatesTask$1(SbtTwirl.scala:108)
    [error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
    [error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
    [error]         at sbt.std.Transform$$anon$4.work(System.scala:67)
    [error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
    [error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
    [error]         at sbt.Execute.work(Execute.scala:278)
    [error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
    [error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
    [error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    [error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    [error]         at java.lang.Thread.run(Thread.java:748)
    [error] a.a.ActorSystemImpl - Internal server error, sending 500 response
    akka.http.impl.util.One2OneBidiFlow$OutputTruncationException: Inner flow was completed without producing result elements for 1 outstanding elements
            at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
            at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
            at akka.http.impl.util.One2OneBidiFlow$One2OneBidi$$anon$1$$anon$4.onUpstreamFinish(One2OneBidiFlow.scala:97)
            at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:504)
            at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:378)
            at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:588)
            at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:472)
            at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:563)
            at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:745)
            at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:760)
    [error] (Compile / twirlCompileTemplates) java.lang.ExceptionInInitializerError
    
    
    
    0 回复