[jboss-user] [EJB 3.0] - @EJB injection always injects remote object, why not local

jainsau do-not-reply at jboss.com
Mon Jul 30 17:26:30 EDT 2007


I have a stateless EJB, and have another EJB injected into this EJB. The injection is straight forward:

@EJB
BeanInteface interface;

The BeanInterface is available in both remote and local forms in the jmx-console-> JNDI view-> list. I am running JBoss 4.2.0 GA, on a single system, so the injection could also return a local proxy. But I always get a remote proxy. I even tried to attribute the injection like this:

@EJB (name="earName/beanName/local")
BeanInteface interface;

but still I only get the remote proxy in the interface variable. Why is this happening? Why can't I fetch the local proxy via injection?

Another slightly related question. Is there a way to find out at runtime (by enquiring the conatiner ?) whether an EJB is available locally or remotely so that I can try to access the correct proxy?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068914#4068914

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068914



More information about the jboss-user mailing list