aspose file tools*
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
Author

Calling EJB from Java client

Jorge Chata
Greenhorn

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() {
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
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling EJB from Java client
 
Similar Threads
Running EJB Client
EJB Client code Error : NameNotFoundException
Calling EJB from Java client
EJB deployment error
I have deployed my ejb with Weblogic and I have a problem with my client