On Aug 26, 2009, at 3:23 AM, Rodger wrote:

Hi,
I have a remote interface my.test.Echo and a ejb my.test.EchoBean.
I don't do any configuration for the jndi in deployment descriptor and deployment plan.

Then using
@EJB(name="my/test/Echo")
private Echo echo;
can find the ejb and run successfully.

But why using
Context ctx = new InitialContext();
Echo echo = (Echo)ctx.lookup("java:comp/env/my/test/Echo");
there is:
javax.naming.NotContextException: my/test/Echo
It isn't widely known but the annotation does create deployment descriptor data. I'm guessing that when you try the second approach, you are removing the annotation and therefore removing the reference from JNDI.

Here is a doc which shows an annotated approach and what those annotations would look like in xml:

http://openejb.apache.org/3.0/ejb-ref.html

Hope this helps.


-David

Reply via email to