my dog learned polymorphism*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
Author

Jndi Error In Client Application

Ramu
Greenhorn

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
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

Joined: Aug 10, 2001
Posts: 3879
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


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ 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: http://aspose.com/file-tools
 
subject: Jndi Error In Client Application
 
Similar Threads
Getting a SocketOrChannelConnectionImpl in Weblogic
EJB Compilation
Client not calling ejb method!!!
weblogic 9 deployment error
Problem while running a client