• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Calling EJB from Java client

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends:
Actually i'm working with an IBM WebSphere Application Server on
Windows NT. I already had deployed entity beans and session beans
in an EJB container. In my servlets I used them without troubles.
But when i tried to call them in a Java application (within Visual Age for Java) i got this error message :
Uncaught exception java.lang.NoClassDefFoundError: javax.naming.InitialContext
This is my application code :
import java.rmi.*;
import java.util.*;
import javax.ejb.*;
import javax.naming.*;
class HelloClient {
public HelloClient() {
super();
}
public static void main(java.lang.String[] args) {
try {
Properties props = new Properties();
props.put(Context.PROVIDER_URL,"iiop:///");props.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
Context ctx = new InitialContext(props);
HelloHome home = (HelloHome) ctx.lookup("com/wiley/compbooks/ecommerce/Hello");
Hello hello = home.create();
System.out.println(hello.hello());
hello.remove();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Thanks for your help
Jorge
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Did you generate the stub of your ejb?
If not the client can't communicate with EJB container.

See rmic -iiop or cmmand line of WebSphere
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic