Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Obtaining InitialContext Failure Question?

4 views
Skip to first unread message

Kevin Tucker

unread,
Aug 20, 2001, 9:20:07 AM8/20/01
to
Hello,
I'm having problems trying to connection the InitialContext() from a client.

I get the same error (see below) if I use "iiop://localhost:900",
"iiop://localhost:9090", "iiop://<machine>localhost:900 ", or
"iiop://<machine>localhost:9090" to obtain the InitialContext. I have the
following jars in my classpath (c:/WebSphere/AppServer/lib/j2ee.jar,
c:/WebSphere/AppServer/lib/websphere.jar,
c:/WebSphere/AppServer/lib/ras.jar,
c:/WebSphere/AppServer/java/lib/tools.jar,
c:/WebSphere/AppServer/lib/ext/ibmorb.jar.

I am able to run the pre-build HelloEJB and Increment ejb-beans with NO
problems. I assume that something with my clients class path is not setup
correctly, but I can not figure out what it is.

Any help or direction on what I am doing wrong here would be appreciated.

Thanks
Kevin

my setup:
Windows2000
WAS 4.0
JBuilder 4.0

my code:
private InitialContext getInitialContext() throws NamingException {
try {
Properties h = new Properties();
h.put( Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory" );
h.put( Context.PROVIDER_URL, "iiop://localhost:900" );
return new InitialContext(h);
}
catch( NamingException ne ) {
log( ne.getMessage() );
ne.printStackTrace();
throw ne;
}
}

my error:

NamingException thrown: NULL returned when resolving initial
reference=NameService

javax.naming.ServiceUnavailableException: NULL returned when resolving
initial reference=NameService
at
com.ibm.ws.naming.util.WsnInitCtxFactory.getCosRootContext(WsnInitCtxFactory
.java:479)
at
com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactor
y.java:336)
at
com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory
.java:199)
at
com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnIniti
alContextFactory.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 osclient.OSTestClient.getInitialContext(OSTestClient.java:108)
at osclient.OSTestClient.lookupHome(OSTestClient.java:88)
at osclient.OSTestClient.<init>(OSTestClient.java:36)
at osclient.OSTestClient.main(OSTestClient.java:59)Unable to look up the
beans home: NULL returned when resolving initial reference=NameService


Jagadeesh

unread,
Aug 20, 2001, 9:27:31 AM8/20/01
to
Hi Kevin,
put this two jars in you clients classpath :

%WAS_HOME%\deploytool\itp\plugins\com.ibm.etools.j2ee\runtime\ejs.jar;

%WAS_HOME%\deploytool\itp\plugins\com.ibm.etools.j2ee\runtime\ujc.jar;

and you can use "iiop://localhost:900" as the provider url if you
are running the client on the server machine itself, else you need to
specify the IP or host name of the server.

hope this solves your problem.

regards,
Jagadeesh


"Kevin Tucker" <TUC...@ONTOS.COM> wrote in message
news:9lr32a$ge2$1...@news.boulder.ibm.com...

Kevin Tucker

unread,
Aug 20, 2001, 1:37:00 PM8/20/01
to
Thanks for the suggestion, but it did not change anything. I still get the
same error after adding the two jars to the classpath. Can you think of
anything else I might have setup wrong.

Thanks
Kevin

Jagadeesh <jagad...@net-kraft.com> wrote in message
news:9lr3c1$rp8$1...@news.boulder.ibm.com...

Lalo Steinmann

unread,
Aug 21, 2001, 12:09:11 AM8/21/01
to
I used to have the same problem, in the same enviroment that you
mencioned.

I fix it, using the ibm JDK, not the sun JDK, which comes with
Jbuilder.
WAS 4.0 comes with an IBM JDK.

I run my test program from the command line using the guidelines
specified in the redbook sg246134
(you can get it from www.ibm.com/redbooks).

I hope it helps.

Lalo Steinmann

"Kevin Tucker" <TUC...@ONTOS.COM> wrote in message news:<9lr32a$ge2$1...@news.boulder.ibm.com>...

Jagadeesh

unread,
Aug 21, 2001, 12:15:49 AM8/21/01
to
Kevin,
Can you tell me more about the error message being generated.
Jagadeesh.


"Kevin Tucker" <TUC...@ONTOS.COM> wrote in message

news:9lri3v$14m0$1...@news.boulder.ibm.com...

Kevin Tucker

unread,
Aug 21, 2001, 9:05:06 AM8/21/01
to
Jagadeesh,

My problem appears to because I was using the Borland JVM (JBuilder 4.0 -JDK
1.3), by switching to the IBM JVM I am now able to successfully create an
InitialContext object. I still don't know the reason why, but it does
work.

Thanks for your time and help.
Kevin

Jagadeesh <jagad...@net-kraft.com> wrote in message

news:9lsncv$1cfs$1...@news.boulder.ibm.com...

0 new messages