This content has been marked as final. Show 2 replies
All you have to do is, use the correct JNDI properties and the jndi-name for the EJB lookup. Something like:
Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); props.put(Context.PROVIDER_URL,"jnp://10.0.0.10:1099"); //1099 is the default. change the port number appropriately. props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming.jnp.interfaces"); Context ctx = new InitialContext(props); MyBeanRemoteInterface bean = (MyBeanRemoteInterface) ctx.lookup("TheJNDINameOfTheBeanOnRemoteServer");
yes ,i tried it again by this way and it can runs well now .