播放测试空指针异常

时间:2013-02-17 14:50:13

标签: playframework playframework-1.x

我在终端上进行游戏(1.2.5)测试 并访问localhost / @测试
该页面说

 Oops: NullPointerException
An unexpected error occured caused by exception NullPointerException:
null

然后在终端

中打印错误堆栈
Internal Server Error (500) for request GET /@tests

Oops: NullPointerException
An unexpected error occured caused by exception NullPointerException: null

play.exceptions.UnexpectedException: Unexpected Error
    at play.Play.start(Play.java:556)
    at play.Play.detectChanges(Play.java:642)
    at play.Invoker$Invocation.init(Invoker.java:198)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:266)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:478)
    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
    at play.Play.start(Play.java:516)
    ... 3 more

1 个答案:

答案 0 :(得分:1)

最后我找到了如何驾驭这个例外。因为我有一个包含两个类的文件。比如

Foo.java:

public class Foo {}
class Bar{}

然后我将Bar类重写为嵌套类,一切都好! Thoung我不知道为什么,似乎是由于eclipse java编译器的一些bug