users@glassfish.java.net

EJB reference injection

From: Danilo Levantesi <danilo.levantesi_at_gmail.com>
Date: Thu, 31 Jul 2008 18:14:56 +0200

Hi to all!
I'm trying to develop a jsf based web app. This web app should get some values
from a remote ejb (deployed on the same Glassfish 2ur2 server).

The EJB is declared as:

@Stateless(name="HelloBean")
public class HelloBean implements HelloBeanRemote { ... }

and is deployed in an EJB module.

The web app has a managed bean, which declares:

public class HelloManagedBean {

    @EJB(name="helloBean", mappedName="HelloBean")
    private HelloBeanRemote helloBeanRef;

    ....
}

Every time I try to access to helloBeanRef I get a NPE (the resource is not
injected).
I tried all the steps in
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#EJB_ejb-ref_ejb_local_ref
without success.

Can someone help me in getting a reference to a remote EJB from a war?
Many thanks!

Danilo