aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How can we resolve NameNotFoundException? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How can we resolve NameNotFoundException?" Watch "How can we resolve NameNotFoundException?" New topic
Author

How can we resolve NameNotFoundException?

Kamal hasan
Greenhorn

Joined: Mar 11, 2007
Posts: 4
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

Joined: Dec 11, 2003
Posts: 86
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.


Unthinking respect for authority is the greatest enemy of truth. -Albert Einstein, physicist, Nobel laureate (1879-1955)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can we resolve NameNotFoundException?