Accessing Sun App Server JNDI context from j2se client

The following client's code snippet is raising javax.naming.NameNotFoundException.

publicstaticvoid main(String[] args)

{

try

{

Context jndiContex = getInitialContext();

Object ref = jndiContex.lookup("java:comp/env/ejb/ru.srpu.jtest.service.UserRemote");

UserRemote user = (UserRemote)PortableRemoteObject.narrow(ref,UserRemote.class);

//logic goes here...

catch (NamingException e)

{

e.printStackTrace();

}

}

publicstatic Context getInitialContext( )throws javax.naming.NamingException

{

Properties p =new Properties( );

p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");

p.put(Context.PROVIDER_URL,"iiop://localhost:3700/");

returnnew javax.naming.InitialContext(p);

}

Beans are packed into the ejb-jar module of the EAR and deployed successfully. EJB's jndi-name is correct as well.

Help to find a bug, please!

[1647 byte] By [straivera] at [2007-11-26 20:00:30]
# 1
We have a number of FAQ entries that cover client JNDI access here :https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html -ken
ksaksa at 2007-7-9 22:58:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Client is working!Thanks for link!
straivera at 2007-7-9 22:58:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...