Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Websphere and the fly likes JNDI lookup function, Cant create Initial Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI lookup function, Cant create Initial Context" Watch "JNDI lookup function, Cant create Initial Context" New topic
Author

JNDI lookup function, Cant create Initial Context

John Jesunamam
Greenhorn

Joined: Mar 27, 2008
Posts: 6
I am using IRAD 6.0. Getting exception.

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:192)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:110)
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)


for the following code.

public static void main(String[] args) {
try {
java.util.Hashtable env = new java.util.Hashtable();
javax.naming.Context initialContext;
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,
"corbaloc:iiop:localhost:2809");


initialContext = new javax.naming.InitialContext(env);

} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

Please help me.
John Jesunamam
Greenhorn

Joined: Mar 27, 2008
Posts: 6
I am new to this technology, so any information would be helpfull. Please post any link to configure the JNDI service or samples, or any idea.

Thank you
John Jesunamam
Greenhorn

Joined: Mar 27, 2008
Posts: 6
Nobody is a veteran in Websphere want to help me? Well I have few more quesitons. Anybody knows code behind dumpNameSpace?
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
You have the same problem as someone in the other thread where you suggested they add the correct JARs to the classpath. This application isn't running inside of the app server so the JARs for naming lookup need to be put on the classpath.
John Jesunamam
Greenhorn

Joined: Mar 27, 2008
Posts: 6
I want the lookup to be in a standalone client similar to dumpNameSpace. I tried adding all the jars, no success till now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI lookup function, Cant create Initial Context