• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to generate stubs

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As we know the clients would interact with the stubs of Home and Remote interface implementation objects. But how do we generate the stubs after the beans, Home and Remote interfaces are created from a JBoss server. I have my Bean,Home, Remote interfaces , ejb-jar.xml and Jboss.xml are all packaged to a jar file and deployed in JBoss. But how does an application client communicate with these beans with out having the stubs. Please let me know, if there is any command or mechanism to generate stubs which can be provided to client.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to guess that you are talking about EJB 2.x (you never said).

The client does not need stubs. All the client needs are the Remote and Remote Home interfaces. Your client looks up the remote home proxy using JNDI and from the proxy obtains the the home proxy.
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter ,

Yes I meant to use ejb 2.1. But would you mind elaborating on your statement


All the client needs are the Remote and Remote Home interfaces. Your client looks up the remote home proxy using JNDI and from the proxy obtains the the home proxy.



In many books I read, it is mentioned that client needs a stub to communicate to the remote objects as client and remote objects do not share a common heap and stubs play a vital role in passing the request , attributes to the remote objects and they are network aware objects.

Please explain your statement.

Thanks
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what you are reading concerns the underlying "plumbing" provided by the client JARs for the EJB container. So what the JBoss client code is doing for you is creating stubs. But the code you write does not have to be concerned with that.

For example, my client code looks something like this:

SomeEjbRemoteHome rh = (SomeEjbRemoteHome)context.lookup(SomeEjbRemoteHome.JNDI_NAME);
SomeEjbRemote ejb = rh.create();
// at this point I can call the methods declared on the EJB
ejb.someMethod();

Notice the my code doesn't have to worry about any stubs, and that the two interfaces, SomeEjbRemoteHome and SomeEjbRemote, are the same interfaces used by my EJB on the server.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic