Dan Kempten wrote:
You should put the @EJB above an instance variable that represents the Bean you wish to inject.
And keep it inside the class.
As I already explained above, that I don't want to inject the ejb. (For there is no way to inject the ejb conditionally.)
That's why I am using the JNDI lookup.
Dan Kempten wrote:
I use it in a web app or a client app to replace this code :
Does your above code works? Where did you define the JNDI name "MyJNDINameOfMyBean"?
Or did you replace the above code b'coz it was not working?
Dan Kempten wrote:
with this code :
By this you are actually injecting the bean, which I don't want to.
If this optional element "mappedName" is not defined, still the ejb does gets injected.
Is there any specific reason for defining this element?
Finally I want to get the ejb reference through JNDI lookup and not by DI.