0

I'm using Dropwizard 8 with Guice Bundle and when i want to instantiate a class that create an actorSystem via @Provides of Guice Framework, i got this exception:

1. java.lang.NoSuchMethodError: scala.collection.immutable.HashSet$.empty()Lscala/collection/immutable/HashSet;
2. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of ma.cars.resources.AdResource errors were found
3. java.lang.IllegalStateException: Unable to perform operation: resolve on ma.cars.resources.AdResource

Here is my classes :

public class AdResource {
private  ActorManager actorManager;
@Inject
public AdResource( ActorManager actorManager) {
    this.actorManager = actorManager;
}
}

in My module i have defined a method that provides the ActorManager :

@Provides
@LazySingleton
@Inject
public final ActorManager getActorManager(CarsConfiguration configuration, AdElasticDTOBuilder dtoBuilder) {
    actorManager = new ActorManager(configuration);
    return actorManager;
}

And here is ActorManager :

    public ActorManager( CarsConfiguration conf,
                    AdElasticDTOBuilder dtoBuilder) {
    this.system =  ActorSystem.create("carsActorSystem");
}

And the Exception is thrown when the create method is called.

I'm using Java 1.8.40/ intellij idea , gradle for dependcy injection and akka-actor 2.3.10.

Here are my dependencies:

dependencies {
compile "io.dropwizard:dropwizard-core:0.8.1"
compile "io.dropwizard:dropwizard-client:0.8.1"
compile "io.dropwizard:dropwizard-hibernate:0.8.1"
compile "io.dropwizard:dropwizard-migrations:0.8.1"
compile "io.dropwizard.modules:dropwizard-java8:0.8.0-2"
compile "io.dropwizard.modules:dropwizard-java8-auth:0.8.0-2"
compile "com.h2database:h2:1.4.186"

compile group: 'com.vividsolutions', name: 'jts', version: '1.13'
compile group: 'net.coobird', name:'thumbnailator', version :'0.4.8'
compile group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '2.10.1'
compile group: 'org.mindrot', name: 'jbcrypt', version: '0.3m'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.6'
compile group: 'com.typesafe.akka', name :'akka-actor_2.10', version :'2.3.10'
compile group: 'org.apache.commons', name :'commons-io', version :'1.3.2'
compile group: 'org.hibernate', name: 'hibernate-spatial', version: '4.3'
compile group: 'com.meltmedia.dropwizard', name: 'dropwizard-jest', version: '0.2.0-SNAPSHOT'


compile "de.thomaskrille:dropwizard-template-config:1.1.0"
compile "com.hubspot.dropwizard:dropwizard-guice:0.8.0"
compile("com.netflix.governator:governator:1.3.3") {
    exclude group: 'com.google.guava', module: 'guava'
    exclude group: 'commons-lang'
}

compile "org.jadira.usertype:usertype.extended:3.2.0.GA"
compile "com.newrelic.agent.java:newrelic-api:3.15.0"
compile("com.wordnik:swagger-jersey2-jaxrs_2.11:1.3.12") {
    exclude group: 'org.glassfish.jersey.containers', module: 'jersey-container-servlet-core'
    exclude group: 'org.glassfish.jersey.core', module: 'jersey-server'
    exclude group: 'com.google.guava', module: 'guava'
}

testCompile "io.dropwizard:dropwizard-testing:0.8.1"
}

Thanks in advance,

Master Mind
  • 3,014
  • 4
  • 32
  • 63
  • What IDE are you using? Are you using scala at all? What are your other relevant dependencies? Are you using maven? Please [edit] your post with the answers to these sorts of questions; I don't think this is a guice problem, I think your depedencies aren't working right somehow. – durron597 May 13 '15 at 13:17
  • Done updated with more info – Master Mind May 13 '15 at 13:31
  • I thought you might be using IDEA. See my next comment – durron597 May 13 '15 at 13:34
  • possible duplicate of [Intellij IDEA java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.hd$1()Ljava/lang/Object](http://stackoverflow.com/questions/26390219/intellij-idea-java-lang-nosuchmethoderror-scala-collection-immutable-coloncol) – durron597 May 13 '15 at 13:34
  • I will check and tell you the result – Master Mind May 13 '15 at 13:35
  • I didn't find how to make the solution , i'm using idea CE java and there is no scala :Settings->Scala->Worksheet – Master Mind May 13 '15 at 13:43
  • Akka depends on scala. See: http://central.maven.org/maven2/com/typesafe/akka/akka-actor_2.10/2.3.10/akka-actor_2.10-2.3.10.pom If you don't see Scala, you need to configure it somehow. Perhaps you need to add the module to IDEA? – durron597 May 13 '15 at 13:45
  • I don't think because it is so gradle would grab the scala dependencies and all in all it would be normal to use a scala library without all the scala stuff. Besides that i'm launching the application via Gradle . – Master Mind May 13 '15 at 13:48
  • See [**How do I fix a NoSuchMethodError?**](http://stackoverflow.com/questions/35186/how-do-i-fix-a-nosuchmethoderror) – durron597 May 13 '15 at 13:49
  • Interesting: i will try to cleanning up the build and see what happens – Master Mind May 13 '15 at 13:55
  • The cleaning did not work – Master Mind May 13 '15 at 14:03
  • @durron597 Thanks for your help i will give you a feedback when i will solve it – Master Mind May 13 '15 at 14:20

0 Answers0