Play框架 - 在开发模式下自动重新编译期间的NullPointerException

时间:2013-07-15 23:55:20

标签: java scala playframework playframework-2.1

每次在应用程序以开发模式运行时更改我的代码时,我都会收到以下异常,并发出导致代码重新编译的服务器请求。如果我退出播放控制台并再次启动它,一切正常......直到下次它必须重新编译。它似乎在项目jar文件中遇到了一些问题,但除此之外我无法弄明白。我在Windows 8上使用Play 2.1.2,我在IDE(Eclipse)中禁用了自动构建。

我应该注意到我最近不得不切换到较慢的机器,而我以前没有遇到这种情况。就我所能想到的而言,设置没有任何区别。

java.lang.NullPointerException:
    java.util.zip.ZipFile.getZipEntry(Unknown Source)
    java.util.zip.ZipFile.access$900(Unknown Source)
    java.util.zip.ZipFile$1.nextElement(Unknown Source)
    java.util.zip.ZipFile$1.nextElement(Unknown Source)
    java.util.jar.JarFile$1.nextElement(Unknown Source)
    java.util.jar.JarFile$1.nextElement(Unknown Source)
    org.reflections.vfs.ZipDir$1$1.computeNext(ZipDir.java:35)
    org.reflections.vfs.ZipDir$1$1.computeNext(ZipDir.java:33)
    com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
    com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
    org.reflections.Reflections.scan(Reflections.java:165)
    org.reflections.Reflections.<init>(Reflections.java:94)
    play.libs.Classpath.getReflections(Classpath.java:48)
    play.libs.Classpath.getTypes(Classpath.java:25)
    play.db.ebean.EbeanPlugin.onStart(EbeanPlugin.java:62)
    play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:68)
    play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:68)
    scala.collection.immutable.List.foreach(List.scala:309)
    play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:68)
    play.api.Play$$anonfun$start$1.apply(Play.scala:68)
    play.api.Play$$anonfun$start$1.apply(Play.scala:68)
    play.utils.Threads$.withContextClassLoader(Threads.scala:18)
    play.api.Play$.start(Play.scala:67)
    play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:141)
    play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:114)
    scala.Option.map(Option.scala:145)
    play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:114)
    play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112)
    scala.util.Either$RightProjection.flatMap(Either.scala:523)
    play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:112)
    play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:104)
    scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
    scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    java.lang.Thread.run(Unknown Source)

2 个答案:

答案 0 :(得分:1)

好像你的某个地方有一个腐败的罐子。重新安装Play将刷新Play正在使用的所有Jars。

答案 1 :(得分:0)

我有同样的错误 (我甚至在github上创建了游戏问题https://github.com/playframework/playframework/issues/4525

后来我找到了我的案例的解决方案:

在build.sbt中我有选项:

// SECTION: Build package configuration
serverLoading in Debian  := SystemV
maintainer in Debian  := "me"
packageSummary in Debian  := "App"
packageDescription := "App"
exportJars := true
defaultLinuxInstallLocation := "/var"
// /SECTION: Build package configuration

如果删除exportJars param,我的应用程序在Windows上感觉良好。