Injection of EJBs isn't currently supported. We plan to add such
support in the future but for now you'll have to fall back to JNDI
lookup instead.
Marc.
On Apr 24, 2008, at 7:33 AM, Persa Zaloshnja wrote:
> Hi all,
>
> I am creating a stateless bean using EJB3.0 and I'd like to inject
> that in jersey web resource. If I inject an ejb to an http/sip
> servlet, it works fine; but when I try the same in a jersey web res,
> it throws a nullpointer exception. A snippet of code for example:
>
>
> @Path("/helloworld")
> public class HelloWorldBean {
>
> //HERE INJECTING THE BEAN USING ANNOTATIONS.
> @EJB(name="ejb/mrbean")
> private IMrBean bean;
>
>
> @GET
> @ProduceMime("text/html")
> public String getClichedMessage() {
> //WHEN CALL FUNCTION getHello() - NULLPOINTER EXCEPTION THROWN!!!
> return bean.getHello();
> }
>
> (the packaging to deploy in glassfish is done in a .ear - jersey web
> resource in .war file and ejb in a .jar file)
>
> Is there anyone who has tried the same, is it possible to inject
> 'anything' to a jersey web resource ?
>
>
> Thank you in advance,
> Farjola
>
>
>
>
> Get news, entertainment and everything you care about at Live.com.
> Check it out!
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.