calling an EJB from a app-client
is there some kind of law that says this has to go in the class with the main method?
@EJB
private static NumberEntityFacadeRemote numberEntityFacade;
because when its in the class with the main method, it works fine, but if i move it over to the class where i need to use it, i get a nullpointer exception
Cheers,
Derek Knapp
[363 byte] By [
kingsoba] at [2007-11-27 4:14:29]

# 2
In Java EE 5, the environment annotations (@EJB, @Resource, @PersistenceContext, etc.) are only
supported on certain managed classes, such as EJB bean classes, servlets, JSF ManagedBeans, and Application Client main classes.
So, in the case of annotations for Application Client components, yes, you need to use the Application
Client main class.The reason the field/method annotations need to be marked as static is that the
entry point for an Applicaiton Client is the main method.In order for the container to ensure that
injection has taken place before main() is called, the container must have class-level (static) field/methods to manipulate.
--ken