Skip to Main Content

Java APIs


For appeals, questions and feedback about Oracle Forums, please email Please ask technical questions in the appropriate category. Thank you!

new initialContext hangs

Adithya GokhaleMay 24 2014

Hello, below is the piece of code which i am trying.

                  String server = System.getenv("NNM_HOSTNAME"); //host where jboss is running

                  String nnmiprotocol = System.getenv("NNM_PROTOCOL"); //http default

                  String nnmi_port = System.getenv("NNM_PORT"); //80 default

                 final Hashtable<Object, Object> env = new Hashtable<Object, Object>();
                 env.put(Context.PROVIDER_URL, nnmiprotocol+"://"+server+":"+nnmi_port+"/invoker/restricted/JNDIFactory");
                 env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
                 env.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
                 env.put(Context.SECURITY_PROTOCOL, "nnm");
                 env.put(Context.SECURITY_PRINCIPAL, m_jUsername);
                 env.put(Context.SECURITY_CREDENTIALS, m_jPasswd);
                 env.put("jnp.disableDiscovery", "true");
                 ic =  new InitialContext(env); //hangs here

When i try this on Linux RHEL 6.4 machine it works fine. But when i try the same on Windows Server 2008 it hangs. When i searched online about this, i found that all the classes mentioned in "env" should be part of class path. I have all of them in java class path. I am using JDK 1.7. What could be the issue ?

Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2014
Added on May 24 2014