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 Jndi Error In Client Application 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 "Jndi Error In Client Application" Watch "Jndi Error In Client Application" New topic

Jndi Error In Client Application


Joined: Dec 06, 2002
Posts: 11
I deployed a Stateless Session bean in Web Sphere Application Server V4.0 AES.
I have written a client program too.
I am running client program in Command Prompt it is giving an error java
If anybody knows those steps please help me.
I am pasting all java classes also below.
Remote Interface
package naveen;
import javax.ejb.*;
import java.rmi.*;
public interface HelloRemote extends EJBObject{
public String sayHello() throws RemoteException;
Home Interface
package naveen;
import javax.ejb.*;
import java.rmi.*;
public interface HelloHome extends EJBHome{
public HelloRemote create() throws CreateException,RemoteException;
Bean Class
package naveen;
import javax.ejb.*;
import java.rmi.*;
public class Hello implements SessionBean{
public void ejbActivate(){}
public void ejbPassivate(){}
public void ejbRemove(){}
public void setSessionContext(SessionContext ctxt){}
public void ejbCreate(){}
public String sayHello(){

return "Welcome To EJB";
Client Program
package naveen;
import java.util.*;
import javax.naming.*;
public class HelloClient{

public static void main(String a[]) throws Exception{
System.out.println("Hello Client Main Method Called...");
Hashtable h=new Hashtable();
System.out.println("Hello Client before context intialization...");
Context ctxt=new InitialContext(h);
System.out.println("Hello Client after context initialization...");
Object o=ctxt.lookup("HelloJndi");
System.out.println("Hello Client LookUP Initialize.....");
HelloHome hh=(HelloHome)o;
HelloRemote hr=hh.create();
This program's output is it's printing "After context intialization"
After that error message
I am giving that error message also:
WSCL0100E: Exception received: java.lang.reflect.InvocationTargetException: java
x.naming.NameNotFoundException: HelloJndi
at javax.naming.InitialContext.lookup(
at naveen.HelloClient.main(
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Native Method)
[ December 06, 2002: Message edited by: Tera Soft ]
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
Yes, this probably means you didn't really use "HelloJndi" as the global name of your EJB when you deployed it. Post the contents of the file ejb-jar-bnd.xmi (found in the META-INF directory of your deployed JAR file) and I'll be able to show you what you actually deployed it to.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

The info we really need to see is in the descriptors. show them.
I agree. Here's the link:
subject: Jndi Error In Client Application
jQuery in Action, 3rd edition