It's not a secret anymore!*
The moose likes EJB and other Java EE Technologies and the fly likes What classes should I provide for my EJB client? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "What classes should I provide for my EJB client?" Watch "What classes should I provide for my EJB client?" New topic
Author

What classes should I provide for my EJB client?

dave taubler
Ranch Hand

Joined: May 15, 2001
Posts: 132
This is a little long, but ultimately, it's surely an easy question for experienced EJB users.

Quick background... I have a lot of experience with Java, including Servlets/JSPs, but am just beginning with EJBs. For the past few months, I've been working on a J2EE app, implemented on Orion web server. This included Stateless Session EJBs. I've followed Orion's tutorials, and have successfully deployed and used my EJBs. The thing is, the "client" and the "server" are both essentially the same application... and they both have access to the same JARs and classfiles.

Now, it's time to actually start using the EJBs the way they're supposed to be used; i.e. remotely. So I'm starting small, with a command-line client that tries to access one EJB. I know that this client needs stubs for the home and remote interface. But... how do I generate these stubs? What exactly do I need to include in the client's classpath to get it to be able to use the remote EJB?

For example, the EJB I am trying to access is BuddyList. I have, of course, BuddyList.class, BuddyListHome.class, and BuddyListBean.class available. My first thought was just to copy BuddyList.class and BuddyListHome.class over for my new client to use. I then tried to invoke the BuddyList bean in the same manner as I have (successfully) invoked the bean from withint the webapp. And I get an error message which seems to stem from the fact that BuddyList and BuddyListHome have dependencies on the javax.ejb package:


Clearly, my little client wouldn't be required to run within an EJB container (I at least know that much!) So... is there a special was to generate stubs/interfaces for my client to use?

Thanks in advance!


Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>
dave taubler
Ranch Hand

Joined: May 15, 2001
Posts: 132
Or, do I need to include something like ejb.jar (which includes the javax.ejb package classes) in my client's classpath?
Natesh Kurup
Greenhorn

Joined: Nov 23, 2004
Posts: 19
hi,

indeed you need to include javax.ejb package in your client classpath.

regards

natesh
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What classes should I provide for my EJB client?
 
Similar Threads
SCBCD: Stubs Question
How to generate stubs
How to create EJB client stubs in JBoss
EJB versioning
where's the "sharpen your pencil" answer?