Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jndi Error In Client Application

 
Ramu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
x.naming.NameNotFoundException
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.io.*;
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();
h.put(Context.PROVIDER_URL,"iiop://localhost:900");
h.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
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();
System.out.println(hr.sayHello());
}
}
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 com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1435)
at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1115)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at naveen.HelloClient.main(HelloClient.java:25)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.websphere.client.applicationclient.launchClient.createContain
erAndLaunchApp(launchClient.java:430)
at com.ibm.websphere.client.applicationclient.launchClient.main(launchCl
ient.java:288)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
[ December 06, 2002: Message edited by: Tera Soft ]
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The info we really need to see is in the descriptors. show them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic