Open ops4j-issues opened 5 years ago
The issue is present in 1.1.4
The URL /sample1/ice
is not present in the integration testing. Adding the following test to itest/src/it/itest-standalone/src/test/java/org/ops4j/pax/cdi/test/ServletTest.java
will test OSGi Service injection.
@Test
public void servletServiceInjection() {
Client client = Client.create();
WebResource resource = client.resource(String.format("http://localhost:%s/sample1/ice", httpPort));
assertThat(resource.get(String.class), is("Message from managed bean\r\n"));
}
Although message text need to be corrected, the following exception is being thrown:
org.jboss.weld.exceptions.IllegalArgumentException: WELD-001408: Unsatisfied dependencies for type IceCreamService with qualifiers @Dynamic @Service @Filter @UniqueIdentifier
at injection point [BackedAnnotatedField] @Inject @Service @Dynamic @Filter private org.ops4j.pax.cdi.sample1.web.IceCreamServlet.chocolate
at org.ops4j.pax.cdi.sample1.web.IceCreamServlet.chocolate(IceCreamServlet.java:0)
See #294 related to POM issue relate to Integration Testing
I'm sorry - last time I checked, the integration tests worked fine, but I agree that the Pax Exam integration test setup is a bit fragile.
The problem is that recently (~2 years) I was refactoring Pax Web (Pax Web 8.0.0 is already released) and I realized that Pax CDI has lots of issues I'll rather won't have the time to fix. Also I was working a bit trying to make Pax Web 8 working with Aries CDI and there's one deadlock left to fix - see ops4j/org.ops4j.pax.web#1622 ;)
Because Aries CDI is an implementation of OSGi R8 CMPN CDI Specification, I'm afraid Pax CDI won't get much attention...
Thank you for the status. I will keep this in mind as I use Pax CDI.
Alexander Rotnov created PAXCDI-239
Bug reproduced with sample bundles "pax-cdi-sample1" and "pax-cdi-sample1-web".
To reproduce get clean Karaf 4.2.5, install required features and sample bundles:
Open URL: http://localhost:8181/sample1/ice
Result is Error 503 Service Inavailable with message:
Affects: 1.0.0, 1.1.0, 1.1.1 Votes: 0, Watches: 1