File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Naming Problem" Watch "Naming Problem" New topic

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>");
String name = args[0];
// Identify service provider to use
Hashtable env = new Hashtable(11);

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);
} catch (NamingException e) {
System.err.println("Problem ******* looking up " + name + ": " + e);
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

Here i got the pbm this progrsm i think
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

Joined: Jul 23, 2001
Posts: 19
Check your classpath and add the approprate jar for com.sun.jndi.fscontext.RefFSContextFactory (jndi.jar).
Read this:
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

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..

I agree. Here's the link:
subject: Naming Problem
It's not a secret anymore!