This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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>
Joined: May 15, 2001
Or, do I need to include something like ejb.jar (which includes the javax.ejb package classes) in my client's classpath?