• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown


Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got NameNotFoundException for my following client main method program.

package client;
* HelloClient.java
* Created on January 27, 2007, 8:37 PM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
import hello.*;
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import javax.ejb.*;
import java.util.*;
* @author Administrator
public class HelloClient {

/** Creates a new instance of HelloClient */
public HelloClient() {

* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
Properties p = new Properties();
p.put(Context.PROVIDER_URL,"file://localhost:3700"); //1099
Context context = new InitialContext(p);
Context ctx=(Context)context.lookup("java:/comp/env");
Object o=ctx.lookup("HelloLocalHome");
System.out.println("home object has been brought");
HelloLocalHome home=(HelloLocalHome)o;
HelloLocal advice=home.create();
catch(Exception ex)


but I got the error as follows.I need to get the answer.help me to solve it.





javax.naming.NameNotFoundException; remaining name 'E:\localhost:3700'

at com.sun.jndi.fscontext.FSContext.checkExists(FSContext.java:850)

at com.sun.jndi.fscontext.FSContext.checkIsDirectory(FSContext.java:883)

at com.sun.jndi.fscontext.FSContext.<init>(FSContext.java:108)

at com.sun.jndi.fscontext.FSContext.<init>(FSContext.java:81)

at com.sun.jndi.fscontext.RefFSContext.<init>(RefFSContext.java:97)

at com.sun.jndi.fscontext.RefFSContextFactory.createContext(RefFSContextFactory.java:42)

at com.sun.jndi.fscontext.RefFSContextFactory.createContextAux(RefFSContextFactory.java:47)

at com.sun.jndi.fscontext.FSContextFactory.getInitialContext(FSContextFactory.java:49)

at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)

at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)

at javax.naming.InitialContext.init(InitialContext.java:219)

at javax.naming.InitialContext.<init>(InitialContext.java:195)

at client.HelloClient.main(HelloClient.java:36)

BUILD SUCCESSFUL (total time: 0 seconds)
Posts: 17347
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the lookup failed, and could be ebcause a few reasons. All related to

1. the Provider_url looks weird to me, it is not normally a "file" and it is usually port 1099 for Naming services.
2. There is one more property that is missing, just don't remember the exact name.

Context ctx=(Context)context.lookup("java:/comp/env");
Object o=ctx.lookup("HelloLocalHome");

Not sure why you "lookup" a context, when you already have the InitialContext and you can lookup your bean from that, so that you only have one network call there, rather than two. You lookup of your bean could be the wrong name.

See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic