2 Replies Latest reply on Dec 14, 2011 4:21 PM by elfuhrer

    WELD-001409 Ambiguous dependencies

    elfuhrer Novice

      I have a custom nosql module that I'm currently testing with Arquillian, I have added all the dependencies to bootstrap Arquillian using TestNG, however when I add the module to archives it complains about a missing class which is available in the archive (MongoStore.class), when I add the class itself I get an exception with the following message:

       

      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [MongoStore] with qualifiers [@Default] at injection point [[field] @Inject org.webpatterns.labs.osgi.service.AuditorManagerBean.mongoStore]. Possible dependencies [[Managed Bean [class org.webpatterns.platform.nosql.mongodb.core.MongoStore] with qualifiers [@Any @Default], Managed Bean [class org.webpatterns.platform.nosql.mongodb.core.MongoStore] with qualifiers [@Any @Default]]]

       

      When I add the class itself without the module I get a CNFE

      Caused by: java.lang.ClassNotFoundException: org.webpatterns.platform.nosql.mongodb.core.MongoStore from [Module "deployment.test.war:main" from Service Module Loader]

       

      My Code goes as follows:

       

       

      @Deployment

        public static Archive<?> createTestArchive() throws URISyntaxException {

              return ShrinkWrap

                      .create(WebArchive.class, "test.war")

                      .addClasses(AuditorManagerBean.class, ApplicationServices.class)

                      .addAsWebInfResource(EmptyAsset.INSTANCE, "seam-beans.xml")

                      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")

                      .addAsResource("mongodb-configuration.json")

                      .addAsLibraries(MavenArtifactResolver.resolve("org.jboss.seam.solder", "seam-solder", "3.0.0.Final"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.jboss.seam.rest", "seam-rest", "3.0.0.Final"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.codehaus.jackson", "jackson-core-asl", "1.9.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.codehaus.jackson", "jackson-jaxrs", "1.9.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.codehaus.jackson", "jackson-mapper-asl", "1.9.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.codehaus.jackson", "jackson-xc", "1.9.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.apache.httpcomponents", "httpcore", "4.1.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.apache.httpcomponents", "httpclient", "4.1.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("commons-logging", "commons-logging", "1.1.1"))

                      .addAsLibraries(MavenArtifactResolver.resolve("commons-io", "commons-io", "2.1"))

                      .addAsLibraries(MavenArtifactResolver.resolve("xalan", "serializer", "2.7.1"))

                      .addAsLibraries(MavenArtifactResolver.resolve("com.google.code.morphia", "morphia", "0.99"))

                      .addAsLibraries(MavenArtifactResolver.resolve("com.google.code.morphia", "morphia-validation", "0.99"))

                      .addAsLibraries(MavenArtifactResolver.resolve("cglib", "cglib-nodep", "2.2.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("com.thoughtworks.proxytoys", "proxytoys", "1.0"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.mongodb", "mongo-java-driver", "2.7.2"))

                      .addAsLibraries(MavenArtifactResolver.resolve("javax.validation", "validation-api", "1.0.0.GA"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.webpatterns.platform", "jscore", "0.0.1-SNAPSHOT"))

                      .addAsLibraries(MavenArtifactResolver.resolve("org.webpatterns.platform.nosql", "mongodb", "0.0.1-SNAPSHOT"))

                      .addClasses(ServicesMap.class, Person.class, MongoStore.class, MongoDBConfiguration.class);

          }

       

      Any help is appreciated