Hello, I'm updating my stack to karaf 4.2.0 from 4.0.10 and having a hard
time injecting OSGI Services from a bundle into my Servlets and
ServletFilters on a web-bundle.

My services are exported using the following blueprint example:

<bean id="WebFinger"
class="br.com.converge.feanor.openid.endpoints.impl.WebFingerImpl" />
<service ref="WebFinger"
interface="br.com.converge.feanor.openid.endpoints.WebFinger" />

On *Karaf 4.0.10* with pax-cdi 1.0.0.RC2 I used @Inject
and @OsgiService (dynamic = true, required = true) annotations on Servlets
to inject the services as:

@WebServlet
public final class WebFingerServlet extends HttpServlet {

@Inject
@OsgiService(dynamic = true, required = true)
private transient WebFinger webFinger;

}

On *Karaf 4.2.0* I've tried @Inject, @Service annotations with and
without @Dynamic annotation as the following example:

@WebServlet
public final class WebFingerServlet extends HttpServlet {

@Inject
@Service
private transient WebFinger webFinger;

}

but the injection failed with the following error:

org.jboss.weld.exceptions.IllegalArgumentException: WELD-001408:
Unsatisfied dependencies for type WebFinger with qualifiers @Service

  at injection point [BackedAnnotatedField] @Service @Inject private
transient
br.com.converge.feanor.server.requestHandlers.openid.WebFingerServlet.we
bFinger

Does anyone have a clue on what I must do to make OSGI services injection
work with pax-web 7.0.0 and pax-cdi 1.0.0 on karaf 4.2.0?

Thanks,

Lucas Ces Santos

Reply via email to