• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Jndi Error In Client Application

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The info we really need to see is in the descriptors. show them.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic