• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can we resolve NameNotFoundException?

 
Kamal hasan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I got the javax.naming.NameNotException : AdviceBean in my ejb local client I have given the complete program below.

import javax.naming.*;
import java.util.*;

public class AdviceClient
{
public static void main(String[] args)
{
try
{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
p.put(Context.PROVIDER_URL,"file:///e:/kramesh-java/ejb/Advice-EJB/classes/headfirst"); //1099
Context context = new InitialContext(p);
Object o=context.lookup("AdviceLocalHome");
System.out.println("home object has been brought");
AdviceLocalHome home=(AdviceLocalHome)o;
AdviceLocal advice=home.create();
System.out.println(advice.getAdvice());
}
catch(Exception ex)
{
ex.printStackTrace();
//System.out.println(ex);
}
}
}

I have the component interface "AdviceLocal"
the home interface "AdviceLocalHome"
the bean implementation class "AdviceBean"

we do the lookup for home interface "AdviceLocalHome".if so, what is the JNDI name for "AdviceLocalHome"?Are the home interface class name and the JNDI name same?How to set JNDI name in netbeans IDE for local home interface and make the lookup?

help me solve this long time problem.
 
Ryan Fernandes
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about trying to list the jndi tree and checking if your bean is deployed correctly. This should also help you locate it and get the 'name' of the bean.

http://tripoverit.blogspot.com/2007/03/print-jndi-tree.html

Cheers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic