Closed lalloni closed 8 years ago
In particular, it seems to be complaining about the type of the returned com.sun.jersey.api.core.ResourceConfig
for JerseyEnvironment.getResourceConfig()
when adding the ScalaBundle
on initialisation. It now returns an org.glassfish.jersey.server.ResourceConfig
.
java.lang.NoSuchMethodError: io.dropwizard.jersey.setup.JerseyEnvironment.getResourceConfig()Lcom/sun/jersey/api/core/ResourceConfig;
at com.massrelevance.dropwizard.bundles.ScalaBundle.run(ScalaBundle.scala:14)
at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:180)
I've dug a bit deeper, and it seems like this is going to be a bigger change that I had thought.
Dropwizard 0.8.0 depends on Jersey 2.16, where 0.7.x depended on Jersey 1.18. Jersey has been moved over to the org.glassfish
namespace since 2.0, so much has changed in the API.
Sorry folks, I'm open to patches (or handing the project off to someone more active) but I don't currently have any time to work on this. :(
I made an attempt at migrating to 0.8 many months ago but didn't get very far, there's quite a bit of change.
FWIW, I've successfully been using dropwizard 0.8 (for many months) with scala simply by registering jackson's scala module. You can do so like this:
import com.fasterxml.jackson.module.scala.DefaultScalaModule
object MyApp extends Application[MyConfiguration] {
override def initialize(bootstrap: Bootstrap[MyConfiguration]): Unit = {
bootstrap.getObjectMapper.registerModule(DefaultScalaModule)
...
}
override def run(cfg: MyConfiguration, env: Environment): Unit = {
...
}
}
You lose out on the ability to use jersey injection of scala Longs/Ints/Booleans/Options/Collections. I never used any of those anyways (I prefer Guice for dependency injection, and json payloads for complex types). Maybe this is good enough for you too? In the worst case scala.collection.JavaConversions can be your friend =).
It's 0.9.2 now. Is this project maintained?
What I suggest in my previous comment is typically sufficient, except that the jackson-module-scala module still suffers from a bug or two that I haven't gotten a chance to track down yet.
Sorry folks, I wasn't using Dropwizard (or Scala) for a long time there.
0.8.5 is released to Maven Central (thanks to others), 0.9.x doesn't work as-is so I'm looking into that.
Currently dropwizard-scala-0.7.1 does not work with the recently released dropwizard-0.8.0 version.