playframework / twirl

Twirl is Play's default template engine
Apache License 2.0
549 stars 108 forks source link

TwirlCompiler NullPointerException on Win7. #175

Open jccode opened 6 years ago

jccode commented 6 years ago

I write a extremely simple demo, which works well on my OSX. When I run it on Win7, it gives me a NPE. I don't know where I'm doing wrong or it's a bug on Windows.

plugins.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12")

build.sbt

name := "play-demo1"

version := "0.1"

scalaVersion := "2.12.5"

lazy val `play-demo1` = (project in file(".")).enablePlugins(PlayScala)

libraryDependencies ++= Seq(
  guice, specs2 % Test,
  "org.webjars" % "bootstrap" % "4.0.0-2"
)

The demo I used is accessable via: https://github.com/jccode/play-demo1

Error trace as belows:

[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:789)                                                                                   
[error]         at scala.collection.immutable.List.foreach(List.scala:389)                                                                                                                     
[error]         at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:788)                                                                                              
[error]         at play.twirl.sbt.TemplateCompiler$.compile(TemplateCompiler.scala:39)                                                                                                         
[error]         at play.twirl.sbt.SbtTwirl$.$anonfun$compileTemplatesTask$1(SbtTwirl.scala:111)                                                                                                
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)                                                                                                                      
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)                                                                                                  
[error]         at sbt.std.Transform$$anon$4.work(System.scala:66)                                                                                                                             
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:262)                                                                                                                            
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)                                                                                                        
[error]         at sbt.Execute.work(Execute.scala:271)                                                                                                                                         
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:262)                                                                                                                            
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)                                                                                 
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)                                                                                                              
[error]         at java.util.concurrent.FutureTask.run(Unknown Source)                                                                                                                         
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)                                                                                                         
[error]         at java.util.concurrent.FutureTask.run(Unknown Source)                                                                                                                         
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)                                                                                                           
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)                                                                                                          
[error]         at java.lang.Thread.run(Unknown Source)                                                                                                                                        
[error] Caused by: java.lang.NullPointerException                                                                                                                                              
[error]         at java.util.Arrays.sort(Unknown Source)                                                                                                                                       
[error]         at scala.tools.nsc.classpath.JFileDirectoryLookup.listChildren(DirectoryClassPath.scala:113)                                                                                   
[error]         at scala.tools.nsc.classpath.JFileDirectoryLookup.listChildren$(DirectoryClassPath.scala:97)                                                                                   
[error]         at scala.tools.nsc.classpath.DirectoryClassPath.listChildren(DirectoryClassPath.scala:202)                                                                                     
[error]         at scala.tools.nsc.classpath.DirectoryClassPath.listChildren(DirectoryClassPath.scala:202)                                                                                     
[error]         at scala.tools.nsc.classpath.DirectoryLookup.list(DirectoryClassPath.scala:73)                                                                                                 
[error]         at scala.tools.nsc.classpath.DirectoryLookup.list$(DirectoryClassPath.scala:69)                                                                                                
[error]         at scala.tools.nsc.classpath.DirectoryClassPath.list(DirectoryClassPath.scala:202)                                                                                             
[error]         at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$list$1(AggregateClassPath.scala:76)                                                                                   
[error]         at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)                                                                                                  
[error]         at scala.collection.Iterator.foreach(Iterator.scala:929)                                                                                                                       
[error]         at scala.collection.Iterator.foreach$(Iterator.scala:929)                                                                                                                      
[error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1417)                                                                                                              
[error]         at scala.collection.IterableLike.foreach(IterableLike.scala:71)                                                                                                                
[error]         at scala.collection.IterableLike.foreach$(IterableLike.scala:70)                                                                                                               
[error]         at scala.collection.AbstractIterable.foreach(Iterable.scala:54)                                                                                                                
[error]         at scala.collection.TraversableLike.map(TraversableLike.scala:234)                                                                                                             
[error]         at scala.collection.TraversableLike.map$(TraversableLike.scala:227)                                                                                                            
[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:267)                                                                           
[error]         at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:267)                                                                                      
[error]         at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1422)                                                                                            
[error]         at scala.tools.nsc.Global$Run.<init>(Global.scala:1164)                                                                                                                        
[error]         at scala.tools.nsc.interactive.Global$TyperRun.<init>(Global.scala:1309)                                                                                                       
[error]         at scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:1332)                                                                                                           
[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:789)                                                                                   
[error]         at scala.collection.immutable.List.foreach(List.scala:389)                                                                                                                     
[error]         at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:788)                                                                                              
[error]         at play.twirl.sbt.TemplateCompiler$.compile(TemplateCompiler.scala:39)                                                                                                         
[error]         at play.twirl.sbt.SbtTwirl$.$anonfun$compileTemplatesTask$1(SbtTwirl.scala:111)                                                                                                
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)                                                                                                                      
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)                                                                                                  
[error]         at sbt.std.Transform$$anon$4.work(System.scala:66)                                                                                                                             
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:262)                                                                                                                            
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)                                                                                                        
[error]         at sbt.Execute.work(Execute.scala:271)                                                                                                                                         
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:262)                                                                                                                            
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)                                                                                 
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)                                                                                                              
[error]         at java.util.concurrent.FutureTask.run(Unknown Source)                                                                                                                         
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)                                                                                                         
[error]         at java.util.concurrent.FutureTask.run(Unknown Source)                                                                                                                         
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)                                                                                                           
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)                                                                                                          
[error]         at java.lang.Thread.run(Unknown Source)                                                                                                                                        
[error] a.a.ActorSystemImpl - Internal server error, sending 500 response                                                                                                                      
scala.MatchError: java.lang.ExceptionInInitializerError (of class java.lang.ExceptionInInitializerError)                                                                                       
        at play.sbt.run.PlayReload$.$anonfun$taskFailureHandler$1(PlayReload.scala:35)                                                                                                         
        at scala.Option.map(Option.scala:146)                                                                                                                                                  
        at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:28)                                                                                                                    
        at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:24)                                                                                                                        
        at play.sbt.run.PlayReload$.$anonfun$compile$3(PlayReload.scala:51)                                                                                                                    
        at scala.util.Either$LeftProjection.map(Either.scala:573)                                                                                                                              
        at play.sbt.run.PlayReload$.compile(PlayReload.scala:51)                                                                                                                               
        at play.sbt.run.PlayRun$.$anonfun$playRunTask$4(PlayRun.scala:76)                                                                                                                      
        at play.runsupport.Reloader.$anonfun$reload$1(Reloader.scala:413)                                                                                                                      
        at play.runsupport.Reloader$$anon$5.run(Reloader.scala:51)                                                                                                                             
[error] (Compile / twirlCompileTemplates) java.lang.ExceptionInInitializerError

Thanks.

marcospereira commented 6 years ago

Hum, I don't have Windows 7 to test this. Could you please use debug log level and see if there is any additional helpful information?

Thanks.