InitialContext create does not respond
suresh.korlapati Mar 29, 2013 11:27 AMAll
something very interesting is happening here. below is my test rmi client class.
1. when i invoke the main method using java command, every thing works, the context gets created and i see the log 'ctx = ..........................'.
2. when i call the 'lookup()' method from another class i don't see the log 'ctx = ..........................'.. it seems context creation does not complete. i don't see any errors in the console and log file
i am totally clueless why it is behaving this way. Any help is higly appreciated
public class AuthRMIClient {
private static Logger logger = Logger.getLogger(AuthRMIClient.class);
public static void main(String[] args) {
lookup();
}
static void lookup() {
try {
Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL,"remote://172.24.1.63:4447");
jndiProps.put("jboss.naming.client.ejb.context", true);
jndiProps.put(Context.SECURITY_PRINCIPAL, "ejbclient");
jndiProps.put(Context.SECURITY_CREDENTIALS, "1password");
jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
// create a context passing these properties
logger.debug("rmi client doing lookup using props object ............");
Context ctx = new InitialContext(jndiProps);
// Context ctx = new InitialContext();
logger.debug("initial ctx = " + ctx);
} catch (NamingException e) {
e.printStackTrace();
}
}
}