|
Home > Archive > WebSphere Application Server > September 2005 > InitalContext failure
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
InitalContext failure
|
|
|
| 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(WsnInitCtxFact
ory.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(WsnInitialContextFacto
ry.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 2005-09-19, 6:04 pm |
| annapurnamungara@yahoo.com wrote:
>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(WsnInitCtxFact
ory.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(WsnInitialContextFacto
ry.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
>
>
What's the code that fails?
Ken
| |
|
| 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
| |
| Ken Hygh 2005-09-19, 6:04 pm |
| annapurnamungara@yahoo.com wrote:
>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
>
>
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
| |
|
| 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
| |
| Ken Hygh 2005-09-19, 6:04 pm |
| annapurnamungara@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
|
|
|
|
|