-
1. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
abhi0123 Mar 6, 2015 9:00 PM (in response to abhi0123)Here's a sample Maven project that demonstrates the problem with 4 classes. Just run 'mvn clean test'.
-
list-injection.zip 4.4 KB
-
-
2. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
jharting Mar 9, 2015 3:40 AM (in response to abhi0123)1 of 1 people found this helpfulHi,
the maven project has "testable=false" on @Deployment which is the reason why the injected bean is null. After removing this "mvn clean test" passes for me locally.
-
3. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
mkouba Mar 9, 2015 3:55 AM (in response to jharting)Jozef is right, if you set
Deployment.testable()
to false your test is not executed in the container - the client mode. See also Test run modes - Arquillian - Project Documentation Editor. -
4. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
abhi0123 Mar 9, 2015 11:01 AM (in response to mkouba)But how's the parent bean injection working in the original question, the one that contains @Produces?
-
5. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
mkouba Mar 9, 2015 11:35 AM (in response to abhi0123)Abhi, I've got two questions:
- Is hospital-user module a separate EJB jar?
- Could you enable the debug logging and check whether the producer beans are recognized (see also http://weld.cdi-spec.org/documentation/#7)
-
6. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
abhi0123 Mar 9, 2015 3:52 PM (in response to mkouba)Answer to q1 is yes, though not full blown EJB jar, just CDI.
It'll be a few days before I can answer q2. I'm in day 1 of a 2000 mile cross-country drive.
-
7. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
mkouba Mar 10, 2015 2:43 AM (in response to abhi0123)Answer to q1 is yes, though not full blown EJB jar, just CDI.
In thi case, we would also need some more info about the deployment structure. If it's not an EJB jar, it must be a shared library. So I suppose your application is packaged as an EAR...
-
8. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
abhi0123 Mar 10, 2015 10:14 AM (in response to mkouba)you're right, ear is the intended format though for now, I'm deploying as war. The module that's expecting the list to be injected is a web module with a dependency on the CDI jar module.
BTW, how do I enable Weld debug logs when testing in Arquillian?
-
9. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
mkouba Mar 11, 2015 3:52 AM (in response to abhi0123)you're right, ear is the intended format though for now, I'm deploying as war. The module that's expecting the list to be injected is a web module with a dependency on the CDI jar module.
Ok. What's the bean discovery mode for the "CDI jar module"?
BTW, how do I enable Weld debug logs when testing in Arquillian?
If using managed or remote container simply modify the XML configuration file (
${WF_HOME}/standalone/configuration/standalone.xml
by default) and watch the${WF_HOME}/standalone/log/server.log
. -
10. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
abhi0123 Mar 14, 2015 2:22 AM (in response to mkouba)Sorry for the late response, as I said, I was on the road.
The bean discovery mode for the CDI jar module is ALL.
I'm using an Arquillian managed Wildfly that's downloaded by the maven-dependency-plugin for every build. It'd be difficult to automatically modify the standalone.xml for it. I guess I could work out a hack to copy a modified standalone.xml to the download location.
That said, it occurred to me that perhaps we should look at how the CDI jar is loaded into Arquillian to make sure that's right to begin with. I'm loading the dependency from the pom and I'm not sure there's anything in it that tells Arquillian to consider the beans.xml from that project.
@Deployment
public static WebArchive createDeployment() throws FileNotFoundException {
File[] hospitalUser = Maven.configureResolver().workOffline()
.withMavenCentralRepo(false).withClassPathResolution(true)
.loadPomFromFile(new File("pom.xml"))
.resolve(HOSPITAL_USER_MVN_COORD).withTransitivity().asFile();
WebArchive app = create(WebArchive.class, SERVICE_NAME + ".war")
.addPackages(true, Filters.exclude(".*Test.*"),
AvailabilityApp.class.getPackage())
.addAsWebInfResource(
new File(WEB_APP_PATH, "WEB-INF/beans.xml"))
.addAsLibraries(hospitalUser);
System.out.println(app.toString(true));
return app;
}
-
11. Re: WELD-001408: Unsatisfied dependencies for type List with qualifiers
mkouba Mar 16, 2015 4:48 AM (in response to abhi0123)The deployment method looks good. WRT the debug logging - the hack is not necessary. Simply copy the WildFly dist into a separate directory and point the JBOSS_HOME env variable there (or change jbossHome in the container config in arquillian.xml).