I am getting the Service Unavailable exception while trying to create
a InitialContext object using Websphere 4.0.
The code is as follows:
try {
ht.put(Context.PROVIDER_URL, "iiop://localhost:900");
ht.put (Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
InitialContext ctx = new InitialContext(ht);
}
catch (Exception ex) {
ex.printStackTrace();
}
The stack trace is as follows:
javax.naming.ServiceUnavailableException: NULL returned when resolving
initial reference=NameService
at com.ibm.ws.naming.util.WsnInitCtxFactory.getCosRootContext(WsnInitCtxFactory.java:451)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:336)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:199)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:79)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.init(InitialContext.java:222)
at javax.naming.InitialContext.<init>(InitialContext.java:198)
at Test.main(Test.java:16)
The client program is running on JBuilder 3.5
I have checked the Websphere documentation; its says that such a
exception could be due to incorrect Hostname specification. But, this
is not true in my case.
Any help will be appreciated.
-Sumit