File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to generate stubs

 
Schandha Ravi
Ranch Hand
Posts: 167
  • 0
  • 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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • 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
  • 0
  • 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
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic