jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes Calling EJB from Java client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Calling EJB from Java client" Watch "Calling EJB from Java client" New topic

Calling EJB from Java client

Jorge Chata

Joined: Jul 06, 2001
Posts: 24
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() {
public static void main(java.lang.String[] args) {
try {
Properties props = new Properties();
Context ctx = new InitialContext(props);
HelloHome home = (HelloHome) ctx.lookup("com/wiley/compbooks/ecommerce/Hello");
Hello hello = home.create();
} catch (Exception e) {
Thanks for your help
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
I agree. Here's the link: http://aspose.com/file-tools
subject: Calling EJB from Java client
It's not a secret anymore!