users@glassfish.java.net

Re: where to find jndi name?

From: Sahoo <Sahoo_at_Sun.COM>
Date: Sun, 03 Feb 2008 22:53:14 +0530

Refer to GlassFish EJB FAQ for the answer:
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

Thanks,
Sahoo

Angelo Chen wrote:
> Hi,
>
> I have this :
> @Remote
> public interface HelloRemote {
> public String sayHi();
> }
>
> @EJB
> private HelloRemote helloRemote = null;
>
> somewhere in the code, I can say:
>
> String msg = helloRemote.sayHi();
>
> above code works, now I need to use lookup in another place, here is what I
> did:
> InitialContext ic = new InitialContext();
> Object obj = ic.lookup(HelloRemote.class.getName());
> helloRemote = (HelloRemote) obj;
> String msg = helloRemote.sayHi();
>
> I always get error :
>
> ejb3.HelloRemote not found at
> com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
> at
> com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
> at
> com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
> at
>
> what is the correct jndi string shoud I use in the lookup? i browse
> Glassfish's jndi view, there was no entry. any idea? Thanks,
>
> Angelo
>
>
>
>
>
>
>
>
>
>
>
>
>