| Scalatra and jetty HTTP client blowing up | Toby Hobson | 26.07.15 14:47 | I'm trying to use Jetty's HttpClient in a Scalatra app but it's blowing up with a weird error. This is the code I wrote: import org.eclipse.jetty.client.HttpClient...get("/get-url/:url") { |
| Re: Scalatra and jetty HTTP client blowing up | Toby Hobson | 26.07.15 15:04 | So I discovered that the exception was caused by my incorrect use of http client which generated a null pointer exception. But I would still be intererested to know why this manifested itself as org.fusesource.scalate.TemplateException: scala.tools.nsc.Global$gen$.mkBlock(Lscala/collection/immutable/List;)Lscala/reflect/internal/Trees$Tree; |
| Re: [scalatra-user] Scalatra and jetty HTTP client blowing up | Ross A. Baker | 26.07.15 15:04 | Scalate embeds the compiler, which is not binary compatible across Scala point releases. Try depending explicitly on `"org.scala-lang" % "scala-compiler" % ScalaVersion`. I prefer not to run a compiler in my applications, and precompile my templates. This avoids this sort of issue at runtime, and avoids that first-page-is-slow hit in production. Template precompilation is set up by default in the g8 template. -- |
| Re: [scalatra-user] Scalatra and jetty HTTP client blowing up | Toby Hobson | 26.07.15 16:04 | Thanks
|
| Re: [scalatra-user] Scalatra and jetty HTTP client blowing up | Toby Hobson | 26.07.15 18:41 | So I added the dependency as you suggested and I'm using the G8 template with precompilation but I'm still seeing this. Any ideas? I don't know if it's significant but the embedded sbt wasn't working because sbt-launch.jar was corrupt (I believe this is a known issue) so I symlinked to the jar in my existing sbt installation
|
| Re: [scalatra-user] Scalatra and jetty HTTP client blowing up | Toby Hobson | 26.07.15 18:54 | It may be a coincidence but it worked when I added all three overrides: dependencyOverrides := Set(It's quite possible that intellij didnt refresh correctly after the first attempt, anyway it's working now :) |
| Re: [scalatra-user] Scalatra and jetty HTTP client blowing up | Stefan Ollinger | 27.07.15 04:01 | Hey, this looks like a SBT issue (incremental compilation and scala-reflect), upgrading SBT to 0.13.8 should resolve it. Regards, Stefan To unsubscribe from this group and stop receiving emails from it, send an email to scalat...@googlegroups.com. |