Question

I'm getting this exception when running the scalatra specs2 example from the scalatra docs:

ThrowableException: org.eclipse.jetty.http.HttpGenerator.flushBuffer()I (FutureTask.java:138)

Here is the test code (starting on line 5, skipping imports):

class MyAppTest extends MutableScalatraSpec {
  addServlet(classOf[MyApp], "/*") 

  "GET / on AdminApp" should {
    "return status 200" in {
      get("/") { 
        status must_== 200
      }
    }
  }
}

Here is the app definition:

class MyApp extends ScalatraServlet {

  get("/") {
    "aloha"
  }
}

I'm using scalatra-specs2 2.0.4 and scala 2.9.1. I'm running an embedded jetty server using xsbt-web-plugin 0.2.10 with sbt 0.11.2. The test was executed using sbt test.

Here is the full trace:

[info] GET / on AdminApp should
[error] ! Fragment evaluation error
[error]     ThrowableException: org.eclipse.jetty.http.HttpGenerator.flushBuffer()I (FutureTask.java:138)
[error] org.eclipse.jetty.testing.HttpTester.generate(HttpTester.java:225)
[error] org.scalatra.test.ScalatraTests$class.submit(ScalatraTests.scala:46)
[error] com.example.MyAppTest.submit(MyAppTest.scala:5)
[error] org.scalatra.test.ScalatraTests$class.submit(ScalatraTests.scala:71)
[error] com.example.MyAppTest.submit(MyAppTest.scala:5)
[error] org.scalatra.test.ScalatraTests$class.get(ScalatraTests.scala:127)
[error] com.example.MyAppTest.get(MyAppTest.scala:5)
[error] com.example.MyAppTest$$anonfun$1$$anonfun$apply$3.apply(MyAppTest.scala:10)
[error] com.example.MyAppTest$$anonfun$1$$anonfun$apply$3.apply(MyAppTest.scala:10)
[error] org.eclipse.jetty.http.HttpGenerator.flushBuffer()I
[error] org.eclipse.jetty.testing.HttpTester.generate(HttpTester.java:225)
[error] org.scalatra.test.ScalatraTests$class.submit(ScalatraTests.scala:46)
[error] com.example.MyAppTest.submit(MyAppTest.scala:5)
[error] org.scalatra.test.ScalatraTests$class.submit(ScalatraTests.scala:71)
[error] com.example.MyAppTest.submit(MyAppTest.scala:5)
[error] org.scalatra.test.ScalatraTests$class.get(ScalatraTests.scala:127)
[error] com.example.MyAppTest.get(MyAppTest.scala:5)
[error] com.example.MyAppTest$$anonfun$1$$anonfun$apply$3.apply(MyAppTest.scala:10)
[error] com.example.MyAppTest$$anonfun$1$$anonfun$apply$3.apply(MyAppTest.scala:10)

This is the only search result that has turned up so far: Fragment Evaluation Error.

Can someone point me in the right direction?

Thanks, -f

Was it helpful?

Solution

You probably have a conflict in your dependencies, more specifically with the Jetty library version. Since the "flush" method on HttpGenerator has changed between Jetty 6 and Jetty 7, you might be getting a "NoSuchMethodFoundError" which explains the strange "org.eclipse.jetty.http.HttpGenerator.flushBuffer()I" signature in the exception message.

This also explains why you get a "fragment evaluation error" and not a regular failure as explained in the link you mentioned.

If you give a go at the latest specs2-1.10-SNAPSHOT, you will get a better message for "fragment evaluation error" showing 'NoSuchMethodError' when that happens. This will help you diagnosing the issue faster.

OTHER TIPS

Still unsure of the root cause, but the test executes successfully after rolling jetty-webapp back from 8.0.3.v20111011 to 7.6.0.v20120127.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top