aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Naming Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Naming Problem" Watch "Naming Problem" New topic
Author

Naming Problem

Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
Hi everyone
I wrote the jndi program .Its compiled ok when i run this pgm i got the following exception.
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Hashtable;
class Lookup {
public static void main(String[] args) {
// Check that user has supplied name of file to lookup
if (args.length != 1) {
System.err.println("usage: java Lookup <filename>");
System.exit(-1);
}
String name = args[0];
// Identify service provider to use
Hashtable env = new Hashtable(11);
System.out.println("::::::::"+env);
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");

try {
Context ctx = new InitialContext(env);
System.out.println("context is :"+ctx);
Object obj = ctx.lookup(name);
System.out.println("Object is :"+obj);
System.out.println(name + " is bound to: " + obj);
ctx.close();
} catch (NamingException e) {
System.err.println("Problem ******* looking up " + name + ": " + e);
}
}
}
Exception;
-----------
Problem ******* looking up \fx.bat: javax.naming.NoInitialContextException: Cann
ot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory [Root exception
is java.lang.ClassNotFoundException: com.sun.jndi.fscontext.RefFSContextFactory
]

Note:
Here i got the pbm this progrsm i think
(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory
I mean com.sun.jndi.fsc.........
So how can i find out whethere the parameter is there or not i mean com.sun.jndi.fscontext.RefFSContextFactory

so any body advise...........
Julian Sitkevich
Greenhorn

Joined: Jul 23, 2001
Posts: 19
Check your classpath and add the approprate jar for com.sun.jndi.fscontext.RefFSContextFactory (jndi.jar).
Read this:
http://java.sun.com/products/jndi/tutorial/getStarted/examples/naming.html
Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
Yes i downloaded the jndi.jar from sun.and i set the classpath too like this
set classpath=%classpath%;c:\jndi.jar;
Even though i got the exception what i send before .
Any advice pls.
manju latha
Greenhorn

Joined: Jul 04, 2002
Posts: 28
oh so simple reddy ..!
put fscontext.jar and providerutil.jar in
your classpath.
U either include them in your CLASSPATH variable
or install them as extensions.
have a try..


manju
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Naming Problem