我一直在使用Play 2.4.0构建我的应用程序,并正在努力解决一些问题,将错误作为Json而不是普通字符串返回。
在这个过程中(不幸的是,我没有'提前做出并经常'所以我不能一分为二,找出导致这个的具体变化)我打破了一些东西,现在当我提出任何要求时(即使是默认的GET /, “欢迎使用Play”,我没有从我使用的激活器模板中更改过)我得到了这个java.lang.NullPointerException,它看起来像是在编译器中发生的。没有任何对我的代码的引用,所以我很难搞清楚我的代码的哪一部分触发了这个错误。看起来它确实与模式匹配有关,但我在整个过程中使用模式匹配。
谢谢!
--- (Running the application, auto-reloading is enabled) ---
[info] p.a.l.c.ActorSystemProvider - Starting application default Akka system: application
[info] p.c.s.NettyServer$ - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 1 Scala source to /Users/sameer/IdeaProjects/sputnik/target/scala-2.11/classes...
java.lang.NullPointerException
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$ScalacPatternExpander$class.applyMethodTypes(ScalacPatternExpanders.scala:64)
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.applyMethodTypes(ScalacPatternExpanders.scala:90)
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.apply(ScalacPatternExpanders.scala:132)
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.apply(ScalacPatternExpanders.scala:153)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$ExtractorCall$.apply(MatchTranslation.scala:384)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.extractor$lzycompute(MatchTranslation.scala:71)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.extractor(MatchTranslation.scala:71)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.paramType$1(MatchTranslation.scala:113)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.extractorStep(MatchTranslation.scala:129)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.nextStep(MatchTranslation.scala:151)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.translate(MatchTranslation.scala:159)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translatePattern(MatchTranslation.scala:318)
at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translatePattern(PatternMatching.scala:89)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateCase(MatchTranslation.scala:315)
at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translateCase(PatternMatching.scala:89)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$$anonfun$3.apply(MatchTranslation.scala:235)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$$anonfun$3.apply(MatchTranslation.scala:235)
at scala.collection.immutable.List.map(List.scala:277)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateMatch(MatchTranslation.scala:235)
at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translateMatch(PatternMatching.scala:89)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:62)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.internal.Trees$$anonfun$itransform$3.apply(Trees.scala:1379)
at scala.reflect.internal.Trees$$anonfun$itransform$3.apply(Trees.scala:1379)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1378)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2559)
at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2559)
at scala.collection.immutable.List.loop$1(List.scala:173)
at scala.collection.immutable.List.mapConserve(List.scala:189)
at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:2559)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1347)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1347)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1366)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1370)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2559)
at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2559)
at scala.collection.immutable.List.loop$1(List.scala:173)
at scala.collection.immutable.List.mapConserve(List.scala:189)
at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:2559)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:62)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.internal.Trees$$anonfun$itransform$3.apply(Trees.scala:1379)
at scala.reflect.internal.Trees$$anonfun$itransform$3.apply(Trees.scala:1379)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1378)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2559)
at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2559)
at scala.collection.immutable.List.loop$1(List.scala:173)
at scala.collection.immutable.List.mapConserve(List.scala:189)
at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:2559)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1347)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1363)
at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1361)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1360)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2589)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2587)
at scala.collection.immutable.List.loop$1(List.scala:173)
at scala.collection.immutable.List.mapConserve(List.scala:189)
at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1404)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:40)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:40)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:40)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:40)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1408)
at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1407)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1406)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2589)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2587)
at scala.collection.immutable.List.loop$1(List.scala:173)
at scala.collection.immutable.List.mapConserve(List.scala:189)
at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1426)
at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1426)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1425)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:40)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:42)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:42)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:42)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:147)
at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:441)
at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:432)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:441)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
at scala.collection.Iterator$class.foreach(Iterator.scala:750)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:399)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1500)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1482)
at scala.tools.nsc.Global$Run.compile(Global.scala:1580)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:51)
at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:51)
at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:51)
at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:75)
at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:50)
at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:65)
at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:62)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:61)
at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:89)
at sbt.inc.Incremental$.compile(Incremental.scala:61)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
at sbt.Compiler$.compile(Compiler.scala:128)
at sbt.Compiler$.compile(Compiler.scala:114)
at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:814)
at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:805)
at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:803)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:235)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (compile:compileIncremental) java.lang.NullPointerException
[error] application -
! @6mhdajb8l - Internal server error, for (GET) [/] ->
play.sbt.PlayExceptions$UnexpectedException: Unexpected exception[NullPointerException: null]
at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:51) ~[na:na]
at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library-2.11.6.jar:na]
at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44) ~[na:na]
at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40) ~[na:na]
at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17) ~[na:na]
at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17) ~[na:na]
at scala.util.Either$LeftProjection.map(Either.scala:377) ~[scala-library-2.11.6.jar:na]
at play.sbt.run.PlayReload$.compile(PlayReload.scala:17) ~[na:na]
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3$$anonfun$2.apply(PlayRun.scala:60) ~[na:na]
Caused by: java.lang.NullPointerException: null
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$ScalacPatternExpander$class.applyMethodTypes(ScalacPatternExpanders.scala:64) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.applyMethodTypes(ScalacPatternExpanders.scala:90) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.apply(ScalacPatternExpanders.scala:132) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.ScalacPatternExpanders$alignPatterns$.apply(ScalacPatternExpanders.scala:153) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$ExtractorCall$.apply(MatchTranslation.scala:384) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.extractor$lzycompute(MatchTranslation.scala:71) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.extractor(MatchTranslation.scala:71) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.paramType$1(MatchTranslation.scala:113) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.extractorStep(MatchTranslation.scala:129) ~[scala-compiler-2.11.2.jar:na]
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$BoundTree.nextStep(MatchTranslation.scala:151) ~[scala-compiler-2.11.2.jar:na]
更新:我发现原因是我有:(其中res是从akka创建的未来“问”)
res.map {
case Accountant.OrderPlaced(order) =>
Created(Json.toJson(order))
case Failure(e) =>
BadRequest(e.toString)
}
但已改为:
res.map {
case Accountant.OrderPlaced(order) =>
Created(Json.toJson(order))
case Status.Failure(e) =>
BadRequest(e.toString)
}
我不清楚为什么会导致这个问题。失败时,我的演员发回一个akka.actor.Status.Failure,我有两个
import akka.actor._
import akka.actor.Status.Failure
在我的导入中,所以我认为上面的两个代码片段是等价的?
答案 0 :(得分:0)
看起来无意中使用了不同的Failure
。例如,在Play 2.4 for Failure中搜索会产生以下可能性列表: