geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: A question about jndi
Date Wed, 26 Aug 2009 15:26:05 GMT

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
>
>
> Who can help me?

This is just a guess :-)
You need to tell geronimo something to indicate that you want the ejb  
available in the java:comp/env jndi namespace.  This can be either the  
annotation you show first or an ejb-ref element in the xml deployment  
descriptor for your app.  If you have removed the annotation and  
forgotten to add the ejb-ref element you will not be able to look up  
the ejb in java:comp/env.

maybe its a lucky guess :-)
david jencks



> Geronimo version 2.2
> -- 
> Best Regards,
> Rodger.


Mime
View raw message