I'm trying to connect to WebSphere from an external
client to do some testing. When I try to get an InitialContext, I get the
following error:
javax.naming.ServiceUnavailableException: NULL
returned when resolving initial reference=NameService
at
com.ibm.ws.naming.util.WsnInitCtxFactory.getCosRootContext(WsnInitCtxFactory.java:452)
at
com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:337)
at
com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:200)
at
com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:665)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at
javax.naming.InitialContext.init(InitialContext.java:222)
at
javax.naming.InitialContext.<init>(InitialContext.java:198)
The following code is how I try to get the
InitialContext:
Properties lProperties = null;
InitialContext
lInitialContext = null;
lProperties = new Properties();
lProperties.put(
Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory" );
lProperties.put(
Context.PROVIDER_URL, "iiop://localhost:900" );
lInitialContext = new
InitialContext( lProperties );
Does anybody have an idea of what I'm doing wrong?
Do I have to 'turn on' the NameService?
Thanks in advance,