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

Re: InitalContext failure

0 views
Skip to first unread message

Ken Hygh

unread,
Sep 19, 2005, 5:58:42 PM9/19/05
to
annapurn...@yahoo.com wrote:

>Hi Ken,
>
>I tried what you suggested.
>
>env.put(Context.PROVIDER_URL,jndiURL.trim());
>InitialContext initctx = new InitialContext(env);
>
>It did not work. Gives me the same Unresolved Context error.
>
>Thanks for your help
>
>Anna
>
>
Look, it's just a String. The call doesn't know if you hardcoded it or
not, it's a String object.

I'd say it's pretty clear that !"iiop://uxm04:9892".equals(jndiURL)

Ken

annapurn...@yahoo.com

unread,
Sep 19, 2005, 11:39:00 AM9/19/05
to
Hi,

I am trying to access EJB running on WAS 5.1 (Unix) from a web application running on WAS 4.0 (Windows). I am doing a iiop call and receive the following error message:

java.lang.ClassCastException: com.ibm.ws.naming.ipbase.UnresolvedContext
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:212)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:98)
at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:79)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:137)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at javax.naming.InitialContext.init(InitialContext.java:231)
at javax.naming.InitialContext.<init>(InitialContext.java:207)


FYI, It works when the context is hardcoded (env.put(Context.PROVIDER_URL,"iiop://uxm04:9892"), but when the value is not hard coded and is mentioned in the configuration file/system property (set on server) I get this unresolved context error.

Does anybody have any idea on why I get this error and how I can successfully get my initialContext created.

Thanks for your help.
Anna

Ken Hygh

unread,
Sep 19, 2005, 12:02:49 PM9/19/05
to
annapurn...@yahoo.com wrote:

What's the code that fails?
Ken

annapurn...@yahoo.com

unread,
Sep 19, 2005, 12:16:28 PM9/19/05
to
Hi Ken,

It fails on the line where it tries to create the InitialContext object (InitialContext initctx = new InitialContext(env)). The jndiURL(iiop://uxm04:9892) is the iiop URL. I am passing the jndiURL in the env Hashtable() to the new InitialContext().

Hashtable env = new Hashtable();
System.out.println("jndiURL:"+jndiURL.trim());

env.put(Context.PROVIDER_URL,jndiURL);

InitialContext initctx = new InitialContext(env);//fails at this point

Thanks for your time.
Anna

annapurn...@yahoo.com

unread,
Sep 19, 2005, 1:33:52 PM9/19/05
to
Hi Ken,

I tried what you suggested.

env.put(Context.PROVIDER_URL,jndiURL.trim());


InitialContext initctx = new InitialContext(env);

It did not work. Gives me the same Unresolved Context error.

Ken Hygh

unread,
Sep 19, 2005, 1:17:21 PM9/19/05
to
annapurn...@yahoo.com wrote:

Assuming that this works:
env.put(Context.PROVIDER_URL,"iiop://uxm04:9892");


InitialContext initctx = new InitialContext(env);

then I'd say you need to
env.put(Context.PROVIDER_URL,jndiURL.trim());


InitialContext initctx = new InitialContext(env);

Ken

0 new messages