播放框架 - 路由到任何URL时重复调用控制器

时间:2017-01-19 08:48:44

标签: java playframework classnotfoundexception playframework-2.5 playframework-routing

我在playframework 2.5.x中遇到路由问题。

一切正常,但每当客户提出请求时。控制器的Result方法将被调用两次以呈现页面。当服务器执行一些繁重的任务时,它将变得危险。

这是我在控制器中的代码

> public Result index() {
>     System.out.println("-----> case index done");
>     Nav.getIntance().setNav("home");
>     return ok(index.render(this.userProvider)); }

当我调试它。调试器抛出java.lang.ClassNotFoundException

我认为这可能是类路径的冲突。

-----> case index done
2017-01-19 15:54:52 [application-akka.actor.default-dispatcher-6] INFO  b.o.d.j.TemplateFailureListenerProvider - No custom TemplateFailureListener found, falling back to no-op implementation.  Don't worry, this is a feature and not a bug.
2017-01-19 15:54:52 [application-akka.actor.default-dispatcher-6] INFO  b.o.deadbolt.java.ViewSupport - Default timeout period for blocking views is [1000]ms
java.lang.ClassNotFoundException: router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$1$$anonfun$apply$1
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$14$$anon$3$$anon$1.invocation(HandlerInvoker.scala:136)
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:73)
        at play.http.HttpRequestHandler$1.call(HttpRequestHandler.java:54)
        at be.objectify.deadbolt.java.actions.AbstractDeadboltAction.authorizeAndExecute(AbstractDeadboltAction.java:292)
        at be.objectify.deadbolt.java.actions.RestrictAction$$Lambda$43/834899689.apply(Unknown Source)
        at be.objectify.deadbolt.java.ConstraintLogic.lambda$restrict$2(ConstraintLogic.java:92)
        at be.objectify.deadbolt.java.ConstraintLogic$$Lambda$47/1688990555.apply(Unknown Source)
        at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:952)
        at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926)
        at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:405)
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
    -----> case index done

你能帮我解决一下吗?

我的所有控制器都使用javax.Inject

然后是我的调试器屏幕截图:

enter image description here

enter image description here

0 个答案:

没有答案