my dog learned polymorphism*
The moose likes Websphere and the fly likes JNDI InitialContext Lookup Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI InitialContext Lookup Exception" Watch "JNDI InitialContext Lookup Exception" New topic
Author

JNDI InitialContext Lookup Exception

Viji San
Ranch Hand

Joined: Aug 12, 2010
Posts: 35

I created a EAR project and an application Client project using RAD 7.5. Client project has been included as a module in EAR. The client project has Main.java (Standalone class).

RAD7.5 has been configured to use local WAS6.0 test environment. JMS resources have been configured in WAS6.0 test environment and SI bus has already been created in WAS. My final goal is to send a message to SI bus queue using Main.java class. But I am getting the below exception during InitialContext lookup itself.

Exception in RAD7.5 console is below:

InitialContext starts....
Aug 11, 2010 10:07:46 PM com.ibm.ws.naming.util.CommonHelpers
WARNING: jndiproviderProperties
Aug 11, 2010 10:07:47 PM com.ibm.ws.naming.util.CommonHelpers
WARNING: jndiproviderProperties
Aug 11, 2010 10:07:47 PM com.ibm.websphere.naming.WsnInitialContextFactory
WARNING: noInitCtxFactoryImpl
Exception in thread "main" javax.naming.ConfigurationException: The property com.ibm.ws.naming.wsn.factory.initial is not set. The most likely cause is that the jar which contains the file com/ibm/websphere/naming/jndiprovider.properties cannot be found by the class loader.
at com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(WsnInitialContextFactory.java:194)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:112)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:675)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:257)
at javax.naming.InitialContext.init(InitialContext.java:233)
at javax.naming.InitialContext.<init>(InitialContext.java:209)
at sender.Main.main(Main.java:29)


Main.java class snippet is below:


I see, Provider URL value as "iiop://localhost:21005/" in Universal Test Client GUI in RAD. RAD uses the default jdk which comes in RAD v7.5. Please help to troubleshoot what is causing this error?. I googled it, but couldn't find the cause. Thanks
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
Can you try using following format of provider URL and post your findings? Generally the boot strap address is 2809.


Viji San
Ranch Hand

Joined: Aug 12, 2010
Posts: 35
I tried with below options, getting the same exception.






Perhaps, I never changed port number after WAS installation, so, the default port should be 2809 for corbaloc. Where can I look for the port number? Am I missing something else?
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You should be able to find the port numbers in WAS under "Servers -> Application servers -> [server1] -> Configuration -> Ports"


Regards, Rene Larsen
Dropbox Invite
Viji San
Ranch Hand

Joined: Aug 12, 2010
Posts: 35
The configured port numbers are below. Here the BOOTSTRAP_ADDRESS port# is 21005. I already tried with this port

Port Name Port


Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
I think your problem is related to classpath. The client application which is trying to do the JNDI lookup is not able to locate the initial context factory class in its classpath. Fix the classpath and you should be all set.
Viji San
Ranch Hand

Joined: Aug 12, 2010
Posts: 35
I'm able to access InitialContextFactory in Main.java (Client) class, also Websphere lib files have been included in the class path. So, don't see any classpath issue for InitialContextFactory class. any other clue?
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Are you using an IBM jdk on the client too ??
Claude Moore
Ranch Hand

Joined: Jun 24, 2005
Posts: 450
    
    1

Deepak Pant wrote:I think your problem is related to classpath. The client application which is trying to do the JNDI lookup is not able to locate the initial context factory class in its classpath. Fix the classpath and you should be all set.


I agree. Time ago, I encountered the same problem, I included some jars of WAS runtime (I just don't rember which ) and the issue has been fixed.
By the way, I remember that those jars were not lightweight... moreover, I was not sure that I could redistribuite them with my application, so I gave up
and searched for another solution....

Viji San
Ranch Hand

Joined: Aug 12, 2010
Posts: 35
I'm using IBM JDK
Viji San
Ranch Hand

Joined: Aug 12, 2010
Posts: 35
I will try to add the jars mentioned in the below thread and test it.
http://www.coderanch.com/t/74068/Websphere/Jars-required-run-stanalone-application
 
jQuery in Action, 2nd edition
 
subject: JNDI InitialContext Lookup Exception