与AkkaSupport与GZipSupport ScalatraServlet(ScalatraS

2019-11-01 08:47发布

我试图使用了Scalatra与AkkaSupport和新引入的(2.2.0 RC2)GZipSupport。 它失败,我想弄清楚,如果我做错事,我才提交错误报告。 该代码是默认了Scalatra /阿卡例如,包括GZipSupport性状:

package com.myapp

import _root_.akka.dispatch._
import _root_.akka.actor._

import org.scalatra._
import org.scalatra.akka.AkkaSupport

class myappServlet extends ScalatraServlet with AkkaSupport with GZipSupport {
  implicit val system = ActorSystem()

  get("/"){
    Future {
      <html><body>Hello Akka</body></html>
    }
  }
}

我发现了以下堆栈跟踪:

[ERROR] [01/08/2013 17:41:42.274] [default-akka.actor.default-dispatcher-2] [akka.dispatch.Dispatcher] STREAM
    java.lang.IllegalStateException: STREAM
at org.eclipse.jetty.server.Response.getWriter(Response.java:699)
at org.scalatra.servlet.RichResponse.writer(RichResponse.scala:80)
at org.scalatra.ScalatraBase$$anonfun$renderPipeline$1.apply(ScalatraBase.scala:301)
at scala.PartialFunction$$anon$3.apply(PartialFunction.scala:97)
at scala.PartialFunction$$anon$3.apply(PartialFunction.scala:96)
at org.scalatra.ScalatraBase$class.loop$1(ScalatraBase.scala:275)
at org.scalatra.ScalatraBase$class.renderResponseBody(ScalatraBase.scala:277)
at org.scalatra.ScalatraServlet.renderResponseBody(ScalatraServlet.scala:50)
at org.scalatra.ScalatraBase$class.renderResponse(ScalatraBase.scala:245)
at com.myapp.myappServlet.org$scalatra$akka$AkkaSupport$$super$renderResponse(triptaoServlet.scala:9)
at org.scalatra.akka.AkkaSupport$$anonfun$renderResponse$1$$anonfun$apply$1.apply(AkkaSupport.scala:61)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
at org.scalatra.DynamicScope$class.withResponse(DynamicScope.scala:50)
at org.scalatra.ScalatraServlet.withResponse(ScalatraServlet.scala:50)
at org.scalatra.servlet.AsyncSupport$$anonfun$withinAsyncContext$1.apply(AsyncSupport.scala:25)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
at org.scalatra.DynamicScope$class.withRequest(DynamicScope.scala:41)
at org.scalatra.ScalatraServlet.withRequest(ScalatraServlet.scala:50)
at org.scalatra.servlet.AsyncSupport$class.withinAsyncContext(AsyncSupport.scala:24)
at com.myapp.myappServlet.withinAsyncContext(triptaoServlet.scala:9)
at org.scalatra.akka.AkkaSupport$$anonfun$renderResponse$1.apply(AkkaSupport.scala:58)
at org.scalatra.akka.AkkaSupport$$anonfun$renderResponse$1.apply(AkkaSupport.scala:56)
at akka.dispatch.Future$$anonfun$onSuccess$1.apply(Future.scala:484)
at akka.dispatch.Future$$anonfun$onSuccess$1.apply(Future.scala:483)
at akka.dispatch.DefaultPromise.akka$dispatch$DefaultPromise$$notifyCompleted(Future.scala:943)
at akka.dispatch.DefaultPromise$$anonfun$onComplete$1.apply$mcV$sp(Future.scala:937)
at akka.dispatch.Future$$anon$4$$anonfun$run$1.apply$mcV$sp(Future.scala:386)
at akka.dispatch.Future$$anon$4$$anonfun$run$1.apply(Future.scala:378)
at akka.dispatch.Future$$anon$4$$anonfun$run$1.apply(Future.scala:378)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
at akka.dispatch.Future$$anon$4.run(Future.scala:378)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:94)
at akka.jsr166y.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1381)
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

这是一些bug还是我失去了一些东西? 提前致谢!

Answer 1:

这是由核心开发了Scalatra承认错误,它被宣布为固定V2.2.1。



文章来源: ScalatraServlet with AkkaSupport with GZipSupport