InitalContext failure
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Application Server > InitalContext failure




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    InitalContext failure  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-05 11:04 PM

Hi,

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

java.lang.ClassCastException: com.ibm.ws.naming.ipbase.UnresolvedContext
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnIni
tCtxFactory.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(WsnInitCtxFact
ory.java:137)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnIn
itialContextFactory.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,"i
iop://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 unresolve
d context error.

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

Thanks for your help.
Anna





[ Post a follow-up to this message ]



    Re: InitalContext failure  
Ken Hygh


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-05 11: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 followi
ng error message:
>
>java.lang.ClassCastException: com.ibm.ws.naming.ipbase.UnresolvedContext
>	at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnI
nitCtxFactory.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(WsnInitCtxFa
ctory.java:137)
>	at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(Wsn
InitialContextFactory.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 i
n the configuration file/system property (set on server) I get this unresolv
ed context error.
>
>Does anybody have any idea on why I get this error and how I can successful
ly get my initialContext created.
>
>Thanks for your help.
>Anna
>
>
What's the code that fails?
Ken





[ Post a follow-up to this message ]



    Re: InitalContext failure  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-05 11:04 PM

Hi Ken,

It fails on the line where it tries to create the InitialContext object (Ini
tialContext initctx = new InitialContext(env)). The jndiURL(iiop://uxm04:989
2) is the iiop URL. I am passing the jndiURL in the env Hashtable() to the n
ew 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





[ Post a follow-up to this message ]



    Re: InitalContext failure  
Ken Hygh


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-05 11:04 PM

annapurnamungara@yahoo.com wrote:

>Hi Ken,
>
>It fails on the line where it tries to create the InitialContext object (In
itialContext initctx = new InitialContext(env)). The jndiURL(iiop://uxm04:98
92) 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





[ Post a follow-up to this message ]



    Re: InitalContext failure  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-05 11:04 PM

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





[ Post a follow-up to this message ]



    Re: InitalContext failure  
Ken Hygh


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-19-05 11: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





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 07:08 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register