-
1. Re: Weld cannot find producer method in library jar
mkouba Apr 13, 2015 3:34 AM (in response to abhi0123)Hi,
I've tried to reproduce the problem and found out that:
- it's not possible to run
mvn clean install
from the root directory - the directory structure is messed up - the test assertion in
ConsumerTest
is wrong:
@Test public void testGetClient() { // You can't do this to test an injected Consumer instance! assertNotNull(new Consumer().getClient()); }
If I move
cdi-consumer
andcdi-producer
dirs tocdi-producer-consumer
and change the assertion to:@Test public void testGetClient(Consumer consumer) { // Let Arquillian to inject an instance from CDI container assertNotNull(consumer.getClient()); }
the test passes. Could you verify my findings?
- it's not possible to run
-
2. Re: Weld cannot find producer method in library jar
abhi0123 Apr 13, 2015 12:20 PM (in response to mkouba)- Correct. The producer and consumer are maven modules and should be inside the parent directory. That's how it is on my local but looks like the export from Eclipse flattened out the structure.
- Correct. My bad, using new operator is totally stupid, the container has to instantiate the class. In fact it looks like direct injection of Client in the test class works too.
I created this project to demonstrate the same problem I was having in a larger project. I'll check there as well and see if I'm missing anything. I appreciate how you took the time to deal with the wrong directory structure and then asked for verification. Unfortunately, a more common approach on the forums is "I couldn't reproduce your problem".
P.S: I tried to reply twice earlier but the site was down.
-
3. Re: Weld cannot find producer method in library jar
mkouba Apr 14, 2015 2:16 AM (in response to abhi0123)Unfortunately, a more common approach on the forums is "I couldn't reproduce your problem".
Well, sometimes it is really difficult to reproduce the problem.
I will close WELD-1921. Feel free to reopen it if you find something relevant in the other project.
-
4. Re: Weld cannot find producer method in library jar
abhi0123 Apr 22, 2015 1:44 AM (in response to mkouba)mkouba I couldn't reproduce the problem in another project even though I tried for days. So I trimmed down the original project to a similar configuration. I can't for my life see any real difference but the following fails to find producer in a jar. Please prove me wrong and no one else will be happier.
Steps to reproduce:
- git clone https://github.com/abhijitsarkar/java-ee.git
- cd hospital-appointment-system.
- mvn clean install.
I'll reopen WELD-1921 too.
-
5. Re: Weld cannot find producer method in library jar
mkouba Apr 22, 2015 4:14 AM (in response to abhi0123)See also my last comment: [WELD-1921] Weld cannot find producer method in library jar - JBoss Issue Tracker.