users@glassfish.java.net

Re: OSGi-enabled Jersey application possible?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 15 Jul 2009 09:33:31 +0200

Hi,

Injection of @Resource on to resource and provider classes is not
currently supported. It is something that will be properly supported,
as with other related EE-based annotations, when the EE 6 integration
is complete, which will occur after the related JSRs (299/330 +
managed beans) become stable.

You can of course use JNDI directly, but there is another way which is
to write your own Jersey InjectableProvider to support @Resource (or a
subset of what is defined for EE). A number of developers are using
the latter technique. If you want to know how to do that i can send
more details.

Paul.

On Jul 14, 2009, at 11:39 PM, glassfish_at_javadesktop.org wrote:

> Hi there,
>
> I found several blog-entries that show how OSGi services are
> injected into a Servlet via @Resource. I tried to do the same within
> a Jersey application, but my service does not get injected.
>
> My bundle is active and I entered the service name as listed in the
> osgi-console into the annotation:
>
> @Resource(mappedName="scoringmodule.HelloService")
> HelloService helloService;
>
> helloService remains null. But I'm actually not even sure, whether
> this is supposed to work anyway.
>
> Any hints or comments on this?
>
> Thanks,
> Ralph
> [Message sent by forum member 'rhwinzin' (rhwinzin)]
>
> http://forums.java.net/jive/thread.jspa?messageID=355683
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>