I am getting NameNotFoundException when I do a look up. Context c = new InitialContext(); Object o = c.lookup("Local"); // 2
I get the exception at line 2. I am wondering why I get this exception when I use EJBLocalHome and EJBLocalObject i.e while dealing with local clients. I dont get this exception when I using EJBObject and EJBHome classes i.e with remote clients. As far my understanding goes the lookup process is the same whether we are dealing with local or remote clients.I am using Reference Implementation server provided by Sun. I am trying to run different applications. One application is where I am using remote clients ad other application is where I am using local clients. When I run my remote client I dont see any NamingException. But when I run my local client then I get NameNotFoundException.Both the applications are nowhere related to each other.I verfied the JNDI name that I provided while deployment to the one the client is doing lookup on. Both the names are matching.
Can anyone please help me out where I am going wrong ?
Local Interfaces are only available by an EJB in the same application server and due to class loading issues mostly only to EJBs in the same EJB/JAR file. Local does not mean, whatsoever, that you can look them up by a Java application on the same computer.
The parameter you have passed in lookup (means jndi name) same jndi should be in Deployment Descriptor which can be created through ant command or writting that deployment descriptor.After all these setting your application will work successfully (not display exception report)